ArgumentNullException: Value cannot be null. Parameter name: path1
This is my code on C#
My application works on Mono/Linux and I don't use security code.
Exception throws when I try to open session.
try { string server = ConfigurationManager.AppSettings["server"]; string user = ConfigurationManager.AppSettings["user"]; string password = ConfigurationManager.AppSettings["password"]; string pathToFolder = ConfigurationManager.AppSettings["pathToFolder"]; SessionOptions options = new SessionOptions(); options.HostName = server; options.Password = password; options.Protocol = Protocol.Scp; options.Timeout = TimeSpan.FromSeconds(20); options.UserName = user; options.SshHostKeyFingerprint = ""; //I don't use security code using (WinSCP.Session session = new WinSCP.Session()) { // Connect session.Open(options); // Upload files TransferOptions transferOptions = new TransferOptions(); transferOptions.TransferMode = TransferMode.Binary; TransferOperationResult transferResult; transferResult = session.PutFiles(@"d:\toupload\*", "/home/user/", false, transferOptions); // Throw on any error transferResult.Check(); // Print results foreach (TransferEventArgs transfer in transferResult.Transfers) { Console.WriteLine("Upload of {0} succeeded", transfer.FileName); } } return true; } catch (Exception ex) { Logs.Error(ex.ToString()); return false; }
Exception throws when I try to open session.