I currently have a dilema where I'm trying to upload a single file (it'll become multiple once I've got round this error), which is no more than 1MB. Originally I had a script executed within a C# application for FTP; worked like a charm. Since moving over to SFTP it has been nothing but issues.
Running the script from within my application, failed.
Running a script file via CMD, failed.
Manually typing it all in CMD, works.
Transferring the file manually via WinSCP, works.
My end goal is to get to how it was before, my app which is scheduled, transfers files as and when.. No manual input. I've done my best to look at other peoples issues and try see if their solutions would work for me, but no such luck as of yet. (Using ** to hide specific information)
Active session:  ***@***
C:\...\Pending\***.750 | 0 B | 0.0 KB/s | binary | 0%
Host is not communicating for more than 15 seconds.
Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
Warning: Aborting this operation will close connection!
Above is the error I've been facing constantly with the (unfortunately) unhelpful Error Code 4. The only relevant errors which could have been feasible were the uploading to a full system or exceeded user disk quote, but I've debunked these and can upload via WinSCP fine straight after an error from my own application.
< 2018-04-20 14:37:54.563 Script: Session started.
. 2018-04-20 14:37:54.563 File: 'C:\**\**\**\**.750' [2018-04-16T14:01:39.000Z] 
. 2018-04-20 14:37:54.564 Copying "C:\**\**\**\**.750" to remote directory started.
. 2018-04-20 14:37:54.564 Binary transfer mode selected.
. 2018-04-20 14:37:54.564 Checking existence of file.
> 2018-04-20 14:37:54.564 Type: SSH_FXP_LSTAT, Size: 21, Number: 5127
< 2018-04-20 14:37:54.573 Type: SSH_FXP_ATTRS, Size: 46, Number: 5127
. 2018-04-20 14:37:54.573 File exists: **.750;-;815151;2018-04-20T13:34:29.000Z;3;"" ;"" ;rwxr-x---;0
. 2018-04-20 14:37:54.573 Checking existence of partially transferred file.
> 2018-04-20 14:37:54.573 Type: SSH_FXP_LSTAT, Size: 30, Number: 5383
< 2018-04-20 14:37:54.580 Type: SSH_FXP_ATTRS, Size: 46, Number: 5383
. 2018-04-20 14:37:54.580 Resuming file transfer.
. 2018-04-20 14:37:54.580 Opening remote file.
> 2018-04-20 14:37:54.580 Type: SSH_FXP_OPEN, Size: 35, Number: 5635
< 2018-04-20 14:37:54.582 Type: SSH_FXP_STATUS, Size: 42, Number: 5635
< 2018-04-20 14:37:54.582 Status code: 4, Message: 5635, Server: Failed to open local file, Language:
> 2018-04-20 14:37:54.582 Type: SSH_FXP_LSTAT, Size: 30, Number: 5895
< 2018-04-20 14:37:54.590 Type: SSH_FXP_ATTRS, Size: 46, Number: 5895
* 2018-04-20 14:37:54.590 (ETerminal) General failure (server should provide error description).
* 2018-04-20 14:37:54.590 Error code: 4
Above is the error log I get client side, unfortunately I don't fully understand the issue from those logs so maybe some one can clarify on that part. I have limited access to the server so I'm unsure on what I could provide there.
Below is the script I'm trying to run manually from CMD, once cracked would transfer it to the application. Also as a side note, I've tried using .NET Assembly for WinSCP and get the exact same error, so at the moment I get the feeling it's Windows related.
open sftp://***!@***.***.com -hostkey="***"# -rawsettings SendBuf=0
put -preservetime -transfer=binary -resumesupport=on "C:\***\***\***\***.74*"
Any and all help will be highly appreciated.