This project is read-only.

Cannot find message [/myfiletoupload.csv]

Jan 13, 2015 at 4:25 PM
Edited Jan 13, 2015 at 4:33 PM

I have a problem sending a file on a certain sftp server given by a customer.
The thing is, It's working great with my debug sftpserver I used to test with but when I want to test on the production sftpserver given by the customer, I get this error.

Maybe someone has an idea ? Specs about the prod sftp are not known :/

Here is my code:
            ObjPrivateKey = new ...
            ObjPrivateKeyAutentication = new ...

            ConnectionInfo objConnectionInfo = new ConnectionInfo(FtpHost, FtpPort, FtpUser, ObjPrivateKeyAutentication);
            var sftp = new SftpClient(objConnectionInfo);
            sftp.WriteAllBytes(filePath, data);
I get the error on WrilteAllBytes method from sftpClient

Here is the Exception Message: Cannot find message [/myfiletoupload.csv]

The Stack Trace:
  at Renci.SshNet.Sftp.SftpSession.RequestFStat(Byte[] handle, Boolean nullOnError)
   at Renci.SshNet.Sftp.SftpFileStream..ctor(SftpSession session, String path, FileMode mode, FileAccess access, Int32 bufferSize, Boolean useAsync)
   at Renci.SshNet.Sftp.SftpFileStream..ctor(SftpSession session, String path, FileMode mode, FileAccess access)
   at Renci.SshNet.SftpClient.OpenWrite(String path)
   at Renci.SshNet.SftpClient.WriteAllBytes(String path, Byte[] bytes)
Thank you in advance !
Jan 14, 2015 at 9:05 AM
Edited Jan 14, 2015 at 9:07 AM
It seems my customer has disabled the shell to let only the sftp with SSH2 1024 key connection.

Is there an option to disable shell commands in SSHNET lib while connecting and trying to upload bytes to sftp server ?

Thanks !
Jul 23, 2016 at 11:03 AM
Hi, I have the exact same problem and this is the only mention I can find of it. Did you find a solution?

Jul 26, 2016 at 9:45 AM

I used the source code instead of the nuget package so I could debug the project and change things I needed to make it work.

It's been a long time,
Hope it helps.
Jul 26, 2016 at 10:34 AM
Thanks. I ended up changing my code to use the fileUpload method instead - which worked.