Causes of "Server response does not contain SSH protocol identification"

May 22, 2015 at 6:43 PM
Hello,

Does anyone ever ran into the "Server response does not contain SSH protocol identification" error?

What can cause that?


I'm using the library in a website to transfer file to another server using sftp. When testing the website from my workstation, everything works. But when I deploy on the dev server (or production) I get that error.

Firewall port is open (I was first getting a firewall error before the port was open)

Anyone got an idea about that error?

Thanks,
Philippe
Apr 15, 2016 at 4:17 PM
I am getting that same error "Server response does not contain SSH protocol identification".
My program sends a file, and pulls a file at certain times (sends a file at 3 a.m., pulls a file at 8 a.m.)

What is puzzling is that the error seems to happen randomly.
Also, when I attempt to re-run the program to send file that failed before, it then works.
Similarly, sometimes the pulling of the file fails, and I re-attempt, then it works.
Sometimes, when I re-attempt it fails, the later the automated program runs, and it works.


What could be causing this apparent random error????
Apr 15, 2016 at 4:27 PM
I forgot to add some information of exactly what piece of code I am using.

my log shows "Connecting..", then I see the exception "Exception caught in BBGenDataApplication.Utils.uploadFile: Server response does not contain SSH protocol identification."
so it could be the connect fails, or it connected, and the ChangeDirectory() fails..
I'll have to put a debug line right after the connect.
Still, the problem is, why it sometimes fails, and sometimes it doesn't?
and in re-attempt, the same file transmission works most of the time.
Thanks
Cecilia


The program fails right after
    public static void uploadFile(String uploadLongFileName)
    {
        try
        {

            // FTP_SERVER, FTP_USER, FTP_PASSWORD are set previously 

            // upload a file
            using (var sftp = new SftpClient(FTP_SERVER, FTP_USER, FTP_PASSWORD))
            {

                Utils.doLog("Connecting...");
                sftp.Connect();

                //(@"/POLP-To-FDC/");
                sftp.ChangeDirectory(@"/POLP-To-FDC/");
                Utils.doLog("moved to dir...");

                // upload the file 
                using (var filestream = File.OpenRead(uploadLongFileName))
                {
                    // upload the file, cannot override (should not need it)
                    sftp.UploadFile(filestream, uploadShortFilename, false);
                    Utils.doLog("uploaded file...");
                }

                sftp.Disconnect();
            } 
        }
        catch (Exception ex)
        {
            errMessage = "Exception caught in " + methodName + ": " + ex.Message;
            Utils.handleCriticalError(errMessage);
        }
    }
Coordinator
Jun 22, 2016 at 3:55 AM
Hi Philippe,

What version of SSH.NET are you using ?
Would it possible to try the recently release 2016.0.0-beta1 ?
What SSH server (and which version) are you using ?

Thanks!
Gert
Jun 27, 2016 at 8:58 PM

Sorry I was out of the office.

I downloaded the source code. Where can I see the release #?

Coordinator
Jun 28, 2016 at 5:21 PM
Edited Jun 28, 2016 at 5:22 PM
Where did you download the sources code from ?
Can't you just use the 2016.0.0-beta1 or 2016.0.0-beta2 nuget packages ?
Jun 28, 2016 at 5:25 PM

Thank you for responding.

Following the instructions to get the latest source code, shown below, I clicked on source code, download..

Which took me to this download: