Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1486
  • Last Modified:

Application connecting to FTP Client Issue

Hello,
I am working on a C# application which connects to FTP client to upload and download files to and from the FTP server.
When I run the application, I receive "COMException occured" error. Error HRESULT E_Fail has been returned from a call to a COM component. The error code is -2147467259.
Here the code where the error occured:
try
                {
                    int connStat = transferEngineConnection.Connect();
                    transferEngineConnection.set_Option("CleanupAsync", 1);
                    transferEngineConnection.set_Option("ThrowError ", 1);
                    transferEngineConnection.set_Option("AutoCloseMethod ", 1);
                    transferEngineConnection.set_Option("AutoCloseDelay  ", 1);

                    logger.Info("Connection Status returned: " + connStat.ToString());
                    return true;
                }
                catch(Exception ex)
                {
                    logger.Info("Connect Call Failed for CuteFTP " + ex.Message + ex.StackTrace);
                    return false;
                }
__________________________________________________________________________________________________________
System.Runtime.InteropServices.COMException occurred
  Message="Error HRESULT E_FAIL has been returned from a call to a COM component."
  Source="Interop.CuteFTPPro"
  ErrorCode=-2147467259
  StackTrace:
       at CuteFTPPro.TEConnectionClass.Connect()
       at NCR.ICCSGateway.ConnectionManager.Connect(TEConnection transferEngineConnection, String userName, String password, String server, String port, String localPath, String remotePath) in D:\NCR.ICCS.Gateway\NCR.ICCS.Gateway.SourceCode\ICCS_Gateway\ICCS_TransferGateway_Component\ICCS_Gateway_UserInterface\ConnectionManager.cs:line 500
  InnerException:

I am using CuteFTP 8 professional.

Thanks
0
houssam_ballout
Asked:
houssam_ballout
3 Solutions
 
ShazbotOKCommented:
(1) dont use Cute ftp...  .NET 2.0 has it's own capability to use FTP right within the framework.. the CuteFTP (depending on the version you have) could be hindering the perfomance of your app by using Interop - AND old methods of transfer.
This is the MSDN developer reference for a example to how to use the FtpWebRequest namespace:
http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest(VS.80).aspx
 
0
 
Anurag ThakurCommented:
even i will recommend you to use the microsoft ftp classes that have come up with version 2.0 of the framework
here is a link of how to upload and download the files to and from the ftp server
http://www.codeproject.com/KB/IP/SimpleFTPDemo.aspx
0
 
houssam_balloutAuthor Commented:
The problem of connectivity between the application and the FTP client was solved by modifying  the configuration of the FTP client; one of the values of the configuration was FTPS which needs to be changed to FTP.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now