Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

.Net and SFTP

jsol5
Advocate II

Thought I'd ask my .net developers if they've seen an issue where FTP is not failing but not necessarily working 100%.

The scenario I have is that when sending a large file via FTP, the file, on occasion, will only send partially.

for example if the file size is 18 mb on the server, we're only seeing a 5mb file on the FTP with no errors (that I can see).

 

Using FIleStream to write the file... 

 

Again, this doesn't happen consistently.  So, I suspect network/connectivity issues, but don't understand why I'm not seeing an error when this happens.  Seems to me my code should through an error.

 

 

Hoping you guys might have some ideas ---

Jeff Letterman‌, David Petty‌, Scott Hagemeyer‌, Ilya Khen

5 REPLIES 5

Ilya_Khen
Champion III

I remember I had this issue with bigger files, like over 1Gb. But that because server did not accept more than 1Gb as a limit.

And server limit outage would not impose any Catch error, but with Java.

Similar I saw here: c# - Renci SSH.NET: SftpClient.UploadFile fails to upload files greater than 1GB in size - Stack Overflow 

 

But for 18Mb, there should not be any issues

Thanks!  I did see that article too.

But, as you said the file isn't nearly as big and since the file does transfer some times, I don't think it's a setting issue.

It might be the same cause as well, I mean when server closes connection, catch block does not trigger.

What I usually do, I use "finally" block from try-catch-finally triangle. There I check either file size between source and destination or checking hash. In case of any inconsistency, I just do reupload.

Done any work with private/public key authentication to a FTP using .net?

Having an issue with private key invalid exception.

I've seen plenty of different code snippets, but I suspect my issue is with how the key pair was generated.

Not an expert in this area, but again I suspect the issue is just with how the key was generated.

Nope, unfortunately never needed