Error '500' & 'Connection timeout' in SecureFTP using WinSCP

Advertisement

gkarthik
Joined:
Posts:
1
Location:
Bangalore, India

Error '500' & 'Connection timeout' in SecureFTP using WinSCP

We use WinSCP tools (WinSCP.exe, WinSCP.dll) for our C# Project for SecureFTP. Attaching the WinSCP DLL & INI files as a Zip file to know about their versions.

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";

session.Open(sessionOptions);

try
{
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Automatic;

TransferOperationResult transferResult;
transferResult = session.PutFiles(sourcePath, remotePath, false, transferOptions);

transferResult.Check();

foreach (TransferEventArgs transfer in transferResult.Transfers)
{
// Display transfer.FileName
}
}

catch()
{
//Contents of Exception Handling
}

finally
{
session.Dispose();
}

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.
Description: Attaching the Zip containing the DLL & INI File for identifying the Versions.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,506
Location:
Prague, Czechia

Re: Error '500' & 'Connection timeout' in SecureFTP using WinSCP

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

Advertisement

You can post new topics in this forum