ReadAllLines and WriteAllLines are not working.
Client has WS_FTP from where we are trying to read/ write but ReadAllLines and WriteAllLines are not working, we are getting below exception,
Renci.SshNet.Common.SshException was unhandled HResult=-2146233088 Message=Folder not found: E:\IPSHOME\SHAREDFOLDERS\EXCHANGE\OUT\test.txt Source=Renci.SshNet StackTrace: 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.OpenRead(String path) at Renci.SshNet.SftpClient.ReadAllLines(String path, Encoding encoding) at Renci.SshNet.SftpClient.ReadAllLines(String path) at SFTP_Test.SFTPHelper.GetFilesInLines(String targetFolder, String targetFileNameStartsWith, String targetFileNameEndsWith, String correlationID) in c:\Users\c-amol.samgir\Documents\Visual Studio 2012\Projects\SFTP_Test\SFTP_Test\SFTPHelper.cs:line 66 at SFTP_Test.Program.Main(String[] args) in c:\Users\c-amol.samgir\Documents\Visual Studio 2012\Projects\SFTP_Test\SFTP_Test\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
We are passing /EXCHANGE/OUT as path, It list out all the files of this directory.
Note : UploadFile and DownloadFile calls are working fine.
Please try using the latest beta (2016.1.0-beta2), and let me know if it works for you.
Have you been able to try 2016.1.0-beta2?
Hi, @drieseng, may I know the root cause of this problem? We hit the similar error with the following call stack (our code is directly calling SftpClient.OpenRead to get a SftpFileStream):
Type=Renci.SshNet.Common.SshException,Message=Folder not found: \*****\test.csv,Source=Renci.SshNet,StackTrace=
at Renci.SshNet.Sftp.SftpSession.RequestFStat(Byte[] handle)
at Renci.SshNet.Sftp.SftpFileStream..ctor(ISftpSession session, String path, FileMode mode, FileAccess access, Int32 bufferSize, Boolean useAsync)
at Renci.SshNet.Sftp.SftpFileStream..ctor(ISftpSession session, String path, FileMode mode, FileAccess access, Int32 bufferSize)
at Renci.SshNet.SftpClient.OpenRead(String path)
at Renci.SshNet.Sftp.SftpSession.RequestFStat(Byte[] handle)
at Renci.SshNet.Sftp.SftpFileStream..ctor(ISftpSession session, String path, FileMode mode, FileAccess access, Int32 bufferSize, Boolean useAsync)
at Renci.SshNet.Sftp.SftpFileStream..ctor(ISftpSession session, String path, FileMode mode, FileAccess access, Int32 bufferSize)
at Renci.SshNet.SftpClient.OpenRead(String path)
And will we get the issue resolved after update to 2016.1.0-beta2? Thanks.
@iRainbow5 We now only invoke RequestFStat(Byte[]) (which sends a SSH_FXP_FSTAT request) in case of an append, so you should no longer get this exception.
@iRainbow5 @amolsamgir1 What SSH server (and version) are you both using?
Thank you @drieseng, I'm using WS_FTP.
@iRainbow5 @amolsamgir1 Can you still reproduce this issue with version 2016.1.0?
No feedback.