This project is read-only.

Strage behavior on Connect()

Jun 20, 2013 at 11:19 PM
I'm utilizing SSH.NET to upload a file to an SFTP server. The process works 100% perfect every time using my example code in LinqPad.
    var sftp = new Renci.SshNet.SftpClient("myserver", 2222, "ksecrist", "mypassword"); 
    sftp.Connect();
    
    var mem = File.OpenRead(@"C:\0_data\IN_ENT_20130620_094640.txt");        
    var asynch = sftp.BeginUploadFile(mem, "/FileTransfers/General/IN_ENT_20130620_091915.txt");

    var sftpASynch = asynch as Renci.SshNet.Sftp.SftpUploadAsyncResult;
         
    while (!sftpASynch.IsCompleted)
    {
        Console.Write(string.Format("\rUploaded {0:#########} KB", (sftpASynch.UploadedBytes / 1024)));
        Thread.Sleep(100);
    }          
                   
    sftp.EndUploadFile(asynch);
    mem.Close();
However, same exact code in a .NET 4.5 project in Visual Studio, and every time I cannot connect....

Renci.SshNet.Common.SshAuthenticationException: No suitable authentication method found to complete authentication.
at Renci.SshNet.ConnectionInfo.Authenticate(Session session)
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()

I thought it might be a .NET version issue so I downgraded my project to .NET 4.0.

Without any code changes, now I get:

System.InvalidOperationException: Server string is null or empty.
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()

All the time the example code in LinqPad works, zero issues.

Both LinqPad and my Visual Studio project are using the latest via NuGet.

Thanks for any insight or possible mitigation workarounds anyone can provide.
Jun 21, 2013 at 5:41 PM
Nevermind my password had a. Minor difference between the two!! Erg