Subject: Asynchronous call exception
Date: 2017-12-06 12:04:19
From: Darren Smith
Source: asynchronous-call-exception
----------------------------------------------------------------------

Hi,   I followed your sample for making an asynchronous file upload unfortunately I get an error. (Details below). The inner exception says that it is not authenticated to the server even though my code authenticates as per your example:    

    public void SendReportViaSFTP(string localPathName)
            {
                try
                {
                    Sftp client = new Sftp();
                    client.Connect(ConfigurationManager.AppSettings["sFTPRemoteServer"], int.Parse(ConfigurationManager.AppSettings["sFTPRemotePort"]));
                    client.Authenticate(ConfigurationManager.AppSettings["sFTPAccountName"], ConfigurationManager.AppSettings["sFTPPassword"]);
                    string remotePath = ConfigurationManager.AppSettings["sFTPRemoteFolder"]   "/"   Path.GetFileName(localPathName);
    
                client.UploadFileCompleted  = client_UploadFileCompleted;
    
                client.BeginUploadFile(localPathName, remotePath);
    
                client.Disconnect();
    
            }
            catch (Exception ex)
            {
    
    ...
                }
            }
        private void client_UploadFileCompleted(object sender, AsyncMethodCompletedEventArgs e)
        {
            Sftp client = (Sftp)sender;
            try
            {
                long transferred = client.EndUploadFile(e.AsyncResult);
            }
            catch(Exception ex)
            {
    
    ...
    
                }
            }










Exception::



    ComponentPro.IO.FileOperationException was caught
      Message=Asynchronous call exception.
      Source=UltimateFileSystem
      StackTrace:
           at ComponentPro.IO.FileSystem.ᛇ(IAsyncResult ਗ਼, MethodBase ক)
           at ComponentPro.Net.Sftp.EndUploadFile(IAsyncResult asyncResult)
           at Elanco.Rebates.ReportProcessor.ReportProcessorThread.client_UploadFileCompleted(Object sender, AsyncMethodCompletedEventArgs e) in C:\dev\All Projects\Veterinary Insights\Elanco Rebates\Elanco.Rebates.ReportsEngine\Elanco.Rebates.WindowsService\ReportProcessorThread.cs:line 501
      InnerException: System.InvalidOperationException
           Message=Not authenticated to the server.
           Source=UltimateSftp
           StackTrace:
                at ComponentPro.Net.Sftp.㶃()
                at ComponentPro.Net.Sftp.UploadFileInternal(С mode, Object state, String remotePath, FileSystem source, String sourceFilePath, Stream sourceStream, Int64 remoteOffset, Int64 localOffset, Int64 length, Boolean fireEvent)
                at ComponentPro.Net.Sftp.UploadFileInternal(С mode, Object state, String remotePath, String localPath, Int64 remoteOffset, Int64 localOffset, Int64 length)
           InnerException: 




----------------------------------------------------------------------

Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand
If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor
who sold you the license and ask for your money back.

Back to ComponentPro Q&A Forum Index