某天在和客戶端進行FTP對接測試時,莫名報錯了,心想不可能吧,不是測試過了嗎?仔細看了Exception内容:
System.TimeoutException
Timed out trying to read data from the socket stream!
System.TimeoutException: Timed out trying to read data from the socket stream!
at FluentFTP.FtpSocketStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken token)
at FluentFTP.FtpSocketStream.ReadLineAsync(Encoding encoding, CancellationToken token)
at FluentFTP.AsyncFtpClient.GetReplyAsyncInternal(CancellationToken token, String command, Boolean exhaustNoop, Int32 timeOut)
at FluentFTP.AsyncFtpClient.GetReply(CancellationToken token)
at FluentFTP.AsyncFtpClient.HandshakeAsync(CancellationToken token)
at FluentFTP.AsyncFtpClient.Connect(Boolean reConnect, CancellationToken token)
at FluentFTP.AsyncFtpClient.Connect(CancellationToken token)
Timed out !!
隨即用FileZilla Client測試,發現是沒問題的啊,怪哉!
滿腦子被Timed out帶風向, 但是FileZilla Client測試又是沒有問題的,這下沒有思路了,只好再認真看一下FluentFTP的説明,終於看到了:
FluentFTP不支援SFTP,改使用SSH.NET
立馬換成SSH.NET就解決了!
結論就是使用任何套件前請仔細閲讀説明文件,以免多走冤枉路,另外Exception的内容不夠具體,也盼望日後能優化啊🙏。
留言
張貼留言