0

I am trying to connect to a sftp server using Tamir.shaprSSH. My sftp server right now is a test server and is an IP address. I can connect to it using FileZilla but not using my code. I tried to connect to another sftp server which my production uses and I am able to connect using the same code .Below is the code and the error when I try to connect

SFTPConnection = new Sftp(_FTPServer, _FTPUserId, _FTPPassword);
        SFTPConnection.Connect();
        SFTPConnection.Put(_LocalFilePath, "./" + _FTPSubFolder);

{"Session.connect: System.IO.IOException: End of IO Stream Read\r\n at Tamir.SharpSsh.jsch.IO.getByte(Byte[] array, Int32 begin, Int32 length)\r\n at Tamir.SharpSsh.jsch.Session.read(Buffer buf)\r\n at Tamir.SharpSsh.jsch.UserAuth.start(Session session)\r\n at Tamir.SharpSsh.jsch.UserAuthNone.start(Session session)\r\n at Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)"} System.Exception {Tamir.SharpSsh.jsch.JSchException}

Is there some issue with the sftp server or my code? I have all the required ddls as well.

andrewsi
  • 10,807
  • 132
  • 35
  • 51
user5462700
  • 11
  • 1
  • 1

2 Answers2

0

Make sure you have added below packages from nuget

Install-Package DiffieHellman Install-Package Org.Mentalis.Security

and also check upload path with exact folder location.

Niraj
  • 775
  • 7
  • 20
0

At time can get this error if you have FIPS enabled on the production server the application was deployed to. If so, you can modify the app.config file and set 'enforceFIPSPolicy' to false and it may resolve your issue.

:)

Jeremy Hobbs
  • 181
  • 3
  • 7