Open avisosoft opened 2 years ago
have found workaround by running quick DownloadFile right before UploadFile
Hm, this workaround is a bit too woodoo for my taste.
I've never had a problem with UploadFile()
, but I've never used ChangeDirectory()
and instead used absolute path in UploadFile()
. Can you try that and see how it works for you?
Just noticed the VPN part in your post... then it all depends on the VPN implementation and configuration I guess...
I'm running into this same issue. Is there a fix?
Solution: In my case I was using SSH.NET library from some xyz vendor removed package from Nugget package manager and then installed SSH.NET by Renci fixed my issue.
issue background: due to some issue infra team has deleted FTP/*/Log directory from Server after that i was getting this issue 'An existing connection was forcibly closed by the remote host'
This exception has been thrown when VPN client is connected. Same code works fine if VPN is switch off.
StackTrace:
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at Renci.SshNet.Abstractions.SocketAbstraction.Send(Socket socket, Byte[] data, Int32 offset, Int32 size) at Renci.SshNet.Session.SendPacket(Byte[] packet, Int32 offset, Int32 length) at Renci.SshNet.Session.SendMessage(Message message) at Renci.SshNet.Session.Renci.SshNet.ISession.SendMessage(Message message) at Renci.SshNet.Channels.Channel.SendData(Byte[] data, Int32 offset, Int32 size) at Renci.SshNet.Channels.Channel.SendData(Byte[] data) at Renci.SshNet.SubsystemSession.SendData(Byte[] data) at Renci.SshNet.Sftp.SftpSession.SendRequest(SftpRequest request) at Renci.SshNet.Sftp.SftpSession.RequestWrite(Byte[] handle, UInt64 serverOffset, Byte[] data, Int32 offset, Int32 length, AutoResetEvent wait, Action
1 writeCompleted) at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action
1 uploadCallback) at Renci.SshNet.SftpClient.UploadFile(Stream input, String path, Boolean canOverride, Action`1 uploadCallback)