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]

Re: I/O Problem

by wodDamir, Friday, August 14, 2009, 19:29 (5579 days ago) @ Christian DeBry

Hi Christian,

Where are you storing the file?

Can you please provide me with LocalPath parameter specified in PutFile?

Does file transfer to/from same locaation work with any other client (FileZilla?)??

Regards,
Damba

Re: I/O Problem

by Christian, Friday, August 14, 2009, 19:53 (5579 days ago) @ wodDamir

Hi Christian,

Where are you storing the file?

Can you please provide me with LocalPath parameter specified in PutFile?

Does file transfer to/from same locaation work with any other client (FileZilla?)??

Regards,
Damba

The file is on my local C: drive. Since I'm still in development, I'm simply using a small text file for testing purposes.

Yes, I can transfer the file via FileZilla, so I know that the external site is functioning properly. I was able to use the native FTP functionality in .Net to send files previously, but ran into some issues when the files became larger than ~50MB. That's one of the reasons for switching to a third-party tool.

Are there any other logs I can write into the code to provide more insight into the problem?

Thanks,
Christian

Re: I/O Problem

by wodDamir, Friday, August 14, 2009, 20:11 (5579 days ago) @ Christian

Christian,

You can try setting debug file. You can do so by doing this:

WeOnlyDo.Client.Ftp.Debug.Log.DebugFile = C:\somefile.txt

However, can you please give me the exact local and remote path you use in PutFile method?

Regards,
Damba

Re: I/O Problem

by Christian, Friday, August 14, 2009, 20:32 (5579 days ago) @ wodDamir

I call the function using the following parameters:

FTPParams: an XML string used for storing the FTP params / credentials
SourceFilePath: C:FTPTest.txt (Also tried C:\FTPTest.txt )
DestinationFilePath: FTPTest.txt (I've also tried many variants of this, such as FTPTest.txt , /FTPTest.txt , , etc.)

I realize the path must be absolute and the FTP site I'm connecting to only has a root directory. The same Source / Destination work when I send to an internal FTP site, so the parameters may not be the issue.

I included the DebugFile code you suggested. Here are the last few rows from that file:

[code]
12:23:29 - ReceiveNotification
12:23:29 - ReceiveNotification len=54
12:23:29 - PROT C 536 Requested PROT level not supported by mechanism.
12:23:29 - ==>Read!
12:23:29 - SendNotification
12:23:30 - <--Done!
12:23:30 - <--Finally!
12:23:30 - ReceiveNotification
12:23:30 - ReceiveNotification len=37
12:23:30 - FEAT 502 Command 'FEAT' not implemented.
12:23:30 - PWD 0
12:23:30 - SendNotification
12:23:30 - PWD 0
12:23:30 - ==>Read!
12:23:30 - <--Done!
12:23:30 - <--Finally!
12:23:30 - ReceiveNotification
12:23:30 - ReceiveNotification len=31
12:23:30 - PWD 257 / is current directory.
12:23:30 - ==>Read!
12:23:30 - SendNotification
12:23:31 - <--Done!
12:23:31 - <--Finally!
12:23:31 - ReceiveNotification
12:23:31 - ReceiveNotification len=20
12:23:31 - TYPE I 200 Type set to I.
12:23:31 - ==>Read!
12:23:31 - SendNotification
12:23:31 - <--Done!
12:23:31 - <--Finally!
12:23:31 - ReceiveNotification
12:23:31 - ReceiveNotification len=51
12:23:31 - PASV 227 Entering Passive Mode (205,145,64,45,22,108).
12:23:31 - ==>Read!
12:23:31 - SendNotification
12:23:32 - <--Done!
12:23:32 - <--Finally!
12:23:32 - ReceiveNotification
12:23:32 - ReceiveNotification len=54
12:23:32 - STOR FTPTest.txt 125 Data connection already open; transfer starting.
12:23:32 - ==>Read!
12:23:32 - DataSendNotification
12:23:32 - <--Done!
12:23:32 - <--Finally!
12:23:32 - ReceiveNotification
12:23:32 - ReceiveNotification len=61
12:23:32 - STOR FTPTest.txt 451 Requested action aborted: I/O problem, file not stored.
[/code]

Re: I/O Problem

by wodDamir, Friday, August 14, 2009, 20:39 (5579 days ago) @ Christian

Christian,

The error you are receiving is returned by the server. This means that the server encountered some problem storing the file.

Can you please try checking RemotePath property immediately after Connect?

This will provide you the initial path you are placed into. You can use it to make sure that you supplied the correct path.

Can you please try that?

Regards,
Damba

Re: I/O Problem

by Christian, Friday, August 14, 2009, 20:56 (5579 days ago) @ wodDamir

The remote path is simply a forward slash (/). I tried setting the LocalPath only (not setting the RemotePath), then called the PutFile command without any parameters, but received the same error.

Do I need to ask the remote server admins to check their log files? Anything else I can do on my end?

Re: I/O Problem

by wodDamir, Friday, August 14, 2009, 21:18 (5579 days ago) @ Christian

Christian,

Is there perhaps any chance we could connect to that server?

If so, could you send us the private account info to techsupport@weonlydo.com ?

I'd like to duplicate this problem if possible.

If not, is there any chance you could provide us with server name? Perhaps we could install it and try out locally?

One more thing. Which one of the FTPS protocol do you use (with or without data)? Can you try both?

Regards,
Damba

Re: I/O Problem

by Christian, Friday, August 14, 2009, 22:55 (5579 days ago) @ wodDamir

Problem solved. I had tried all the FTPS protocols earlier, but that must have been before some other adjustments. When I switched back to FTPS With Data, I was able to transmit the file.

Ugh. I guess that's happens when you work on the same problem for too long. Thanks for all your help!