I/O Problem - WeOnlyDo Discussion board

I/O Problem (General questions)

by Christian DeBry, Friday, August 14, 2009, 19:20 (5579 days ago)

I've managed to get FTP functionality to work when sending a file to an internal FTP site; however, when I try to send to a certain external FTP site, I get the following error:


WeOnlyDo.Exceptions.FtpDLX.ProtocolException: Requested action aborted: I/O problem, file not stored.

I checked the State and confirmed that the connection is established. But an exception is thrown when the PutFile command is executed. Any ideas as to how to diagnose / fix this problem? (Note: the external site uses FTPS protocol and I've set the blocking property to true.)

Here's the code:

[code]
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString ftp_file(string FTPParams, string SourceFilePath, string DestinationFilePath)
{
// convert FTPParams to XML
XmlDocument Config = new XmlDocument();
Config.LoadXml(FTPParams);

// initialize FTP object
FtpDLX ftp = new FtpDLX();
ftp.LicenseKey = XXXX-XXXX-XXXX-XXXX ; // set license key for product
ftp.Blocking = true; // use synchronous connection

// transfer protocol (must be set before the port parameter)
switch(Config.SelectSingleNode( //Protocol ).InnerText)
{
case FTP :
ftp.Protocol = Protocols.FTP;
break;
case FTPS :
ftp.Protocol = Protocols.FTPS;
break;
case FTPSImplicit :
ftp.Protocol = Protocols.FTPSimplicit;
break;
case FTPSWithData :
ftp.Protocol = Protocols.FTPSwithdata;
break;
case SFTP :
ftp.Protocol = Protocols.SFTP;
break;
default:
return Fail ;
}

// transfer mode
if (Config.SelectSingleNode( //TransferMode ).InnerText == Passive )
{
ftp.Passive = true;
}
else
{
ftp.Passive = false;
}

// credentials
ftp.Hostname = Config.SelectSingleNode( //Domain ).InnerText;
ftp.Port = Int32.Parse(Config.SelectSingleNode( //Port ).InnerText);
ftp.Login = Config.SelectSingleNode( //Login ).InnerText;
ftp.Password = Config.SelectSingleNode( //Password ).InnerText;

// send file
ftp.Connect();
try
{
ftp.PutFile(SourceFilePath, DestinationFilePath);
}
catch (Exception ex)
{
return Error: + ex.Message;
}
finally
{
ftp.Disconnect();
}

return Pass ;
}
}
[/code]


Complete thread: