Sftp.PutFile() doesn't fail, but server doesn't get the file and NO error .

0 votes
asked Feb 11 by Vinay (240 points)

Hi Support
periodically sftp.putfile() fails to send the file and without any exceptions
I tried to capture the debug error log using below code but log has only 4 lines.

client.PutFile(@sourcepath + filename, destinationPath + filename);
client.LogWriter = new Rebex.FileLogWriter(@"\\Test\Log", Rebex.LogLevel.Debug);

log :

2021-02-11 15:02:45.127 Opening log file.
2021-02-11 15:02:45.129 INFO FileLogWriter(1)[1] Info: Assembly: Rebex.Common 2018 R2 for .NET 4.0-4.7
2021-02-11 15:02:45.130 INFO FileLogWriter(1)[1] Info: Platform: Windows 6.2.9200 32-bit; CLR: 4.0.30319.42000
2021-02-11 15:02:45.131 DEBUG FileLogWriter(1)[1] Info: Culture: en; Windows-1252

Please suggest .

Thanks,
Vinay

Applies to: Rebex SFTP

1 Answer

0 votes
answered Feb 11 by Lukas Pokorny (118,730 points)

If the PutFile method finished without an exception, then it means it actually succeeded. Perhaps you uploaded the file into an unexpected directory?

To find out what is going on, please assign the LogWriter property before calling the PutFile method, and run the code again. Then check the log.

var client = new Sftp();
client.Connect(...);
client.Login(...);
client.LogWriter = new Rebex.FileLogWriter(@"\\Test\Log", Rebex.LogLevel.Debug);
client.PutFile(@sourcepath + filename, destinationPath + filename);
...