We connect to WinSCP for Secure FTP of different files to different FTP Servers simultaneously.
Getting the error "The remote server returned an error: (500) Syntax error, command unrecognized." most of the times.
Getting "Network error: Connection timed out." also at some times.
These errors are not occurring for the same file/server each time.
So, not able to find out the pattern when the error occurs.
These errors are not related to : Size of the file or connecting to same server simultaneously using Threads.
Please go through the code part given below and let me know what could be reason for errors.
This is the code part related to WinSCP which will be called every time a File has to be FTP-ed :
Session Options setting :
SessionOptions sessionOptions = new SessionOptions
FtpMode = FtpMode.Passive,
Protocol = Protocol.Sftp,
HostName = ftpServerIP,
UserName = ftpUserID,
Password = ftpPassword,
GiveUpSecurityAndAcceptAnySshHostKey = true
using (Session session = new Session())
session.ExecutablePath = CurrentPath + "WinSCP_EXE\\WinSCP.exe";
session.IniFilePath = CurrentPath + "WinSCP_EXE\\WinSCP.ini";
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Automatic;
transferResult = session.PutFiles(sourcePath, remotePath, false, transferOptions);
foreach (TransferEventArgs transfer in transferResult.Transfers)
// Display transfer.FileName
//Contents of Exception Handling
Please let me know what could be reason of the error and why it fails at different place and different times. Thanks in advance, for the help.