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

Author Message
gkarthik
[View user's profile]

Joined: 2013-10-14
Posts: 1
Location: Bangalore, India
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.
WinSCP.zip (47.19 KB) [Download]

Description: Attaching the Zip containing the DLL & INI File for identifying the Versions.

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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.

_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License