I'm currently facing a really strange problem in one of my projects.
I've implemented Tamir Gal's Sharp SSH Library in my code to upload some files per FTP. When I run the code in Debug Mode everything works just as it should. But when I build the solution and try it with that built version, I get a System.IO.IOException:
Tamir.SharpSsh.jsch.JSchException: Session.connect: System.IO.IOException: End of IO Stream Read at Tamir.SharpSsh.jsch.IO.getByte(Byte[] array, Int32 begin, Int32 length)
at Tamir.SharpSsh.jsch.Session.read(Buffer buf)
at Tamir.SharpSsh.jsch.User.Auth.start(Session session)
at Tamir.SharpSsh.jsch.UserAuthNone.start(Session session)
at Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
at Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
at Tamir.SharpSsh.jsch.SshBase.ConnectSession(Int32 tcpPort)
at Tamir.SharpSsh.jsch.SshBase.Connect(Int32 tcpPort)
at Tamir.SharpSsh.jsch.SshBase.Connect()
It looks like there's a Problem with the Data Stream (Hello Captain Obvious! :) ), so the Program doesn't even establish to finish the Connect Method. I just don't get why everything works while debugging. The dlls get copied correctly in the building process.
The code looks like this:
sftpClient = new Sftp(this.ftpHost, this.ftpUser, this.ftpPassword);
sftpClient.Connect();
All the variables have the correct values and I can connect to the SFTP server using them in a client like Filezilla.
If anybody could give me a hint or has had a similiar problem, I would be very thankful for every comment.
Thank you all in advance and have a nice day.
My colleague just found the solution:
In SharpSSH you have 3 Dlls:
Because I never had to reference Org.Mentalis.Security.dll in the code i totally forgot to copy it during the build process. Because of this the whole Security Layer which SharpSSH relays on wasn't accessible and that's what caused the error.
I hope this thread can help a few other oblivious people. :)