Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Causes of "Server response does not contain SSH protocol identification"

$
0
0
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);
        }
    }

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>