Home › Forums › .NET libraries › Xceed SFTP/FTP for .NET › FTP over SSL breaks
-
AuthorPosts
-
#21449 |
Hey,
I was trying to test FTP over SSL to transfer a new data when available. Looks like, I keep getting this exception:
Xceed.Ftp.FtpInvalidStateException: Cannot perform the requested operation because the FTP client is already connected to an FTP server.
at Xceed.Ftp.FtpClient.SetState(FtpClientState newState)
at Xceed.Ftp.FtpClient.Connect(String hostName, Int32 port)
The FTPS works good for 30 minutes and then breaks and never lets the client connect, never gets logged in to the server. Also, it takes very long to authenticate the user when the client receives the certificate from the server.
Thanks,
Rahul
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Rahul (had 656 views)
Hi Rahul,
In order to investigate further, we would need the following information:
1) TraceWriter log
You can set the TraceWriter property so the communication with the FTP server is logged.
For example:
FtpClient myFtpClient = new FtpClient();
myFtpClient.TraceWriter = new StreamWriter( @”D:\Log\XceedFtp.log”, true );or
FtpConnection myFtpConnection = new FtpConnection( ftpServer );
myFtpConnection.TraceWrite = new StreamWriter( @”D:\Log\XceedFtp.log”, true );2) Complete Exception log
When you get the exception, you can “drill down” the inner exception to get more information. Each System.Exception object contains an InnerException property.
You can loop on each inner exception, taking note of each exception along the way until InnerException is null.
For example:
try
{
// TODO: Code that causes an exception
}
catch( Exception exception )
{
// Output some information about it
Console.WriteLine( “–>{0}: {1}\n{2}”, exception.GetType().Name, exception.Message, exception.StackTrace );// Fetch the inner exception
exception = exception.InnerException;// While there is an exception
while( exception != null )
{
// Output some information about it
Console.WriteLine( “–>Inner exception: {0}: {1}\n{2}”, exception.GetType().Name, exception.Message, exception.StackTrace );// Fetch the inner exception
exception = exception.InnerException;
}
}Please send both logs to support@xceed.com and include a link to this forum thread for reference. Thank you.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 158 views)
Hi Diane,
I cannot get the TraceWriter due to confidentiality policy, all I can share is the stack trace where it is failing.
at Xceed.Ftp.Engine.FtpCommandChannel.EndReceiveReply(IAsyncResult asyncResult)
at Xceed.Ftp.Engine.FtpCommand.EndReceiveReply(IAsyncResult asyncResult)
at Xceed.Ftp.Engine.FtpCommand.Execute(FtpCommandChannel commandChannel)
at Xceed.Ftp.Engine.BaseFtpCommand.BackgroundWorker_DoWork(Object sender, DoWorkEventArgs e)
at Xceed.Ftp.BackgroundWorkerWrapper.OnDoWork(DoWorkEventArgs eventArgs)
at Xceed.Ftp.BackgroundWorkerWrapper.DoWorkThreadStart()
— End of inner exception stack trace —
at Xceed.Ftp.Engine.FtpCommand.EndExecute(IAsyncResult asyncResult)
at Xceed.Ftp.FtpClient.DoExecuteCommand(FtpCommandChannel commandChannel, BaseFtpCommand command)
at Xceed.Ftp.FtpClient.ChangeCurrentFolder(String folder)
I’m sorry, I cannot share any more details of the transfer between the client and the server.
Please let me know if you find the information useful.
Thanks,
Rahul
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Rahul (had 98 views)
Hi Rahul,
The TraceWriter doesn’t contain confidential information. It contains the commands and responses between the client and the server as well as the IP address of the Ftp server and the username used to authenticate. The password is never included in the log nor are the file contents or the file listings.
Can you show us the code you use to connect to the server and transfer a file?
From the exception, it looks like the way you’re handling errors is incorrect. If a file transfer fails for some reason, it doesn’t mean that you are no longer connected to the server.
Before you try to reconnect to the server, you can check the state of the connection before calling Connect() with the Connected property. If the value is true, you will get the FtpInvalidStateException when you call Connect() because the client is already connected.
Note: feel free to send any information that you would prefer to not post online, to support@xceed.com instead.
Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 741 views)
-
AuthorPosts
- You must be logged in to reply to this topic.