A connection attempt failed because the connected party did not properly respond

Oct 16, 2013 at 11:03 AM
Edited Oct 16, 2013 at 11:05 AM
Hi all,

I'm getting the below problem when deploying our app to our Azure production and UAT environments. Running this app locally causes no problems whatsoever. The application makes a number of attempts to connect to list directorys or download files into streams within a short space of time. However this exception is thrown in the test case after the first attempt to connect. However it should also be noted that this does not always happen, and soemtimes the client connects successfully.

Any ideas would be gratefully appreciated!!!

All variables are correct, I've installed VS up on the UAT box and made sure of this.
var connInfo = new PasswordConnectionInfo(this.host, this.port, this.username, this.password);
            using (this.client = new SftpClient(connInfo))
            {
                client.ErrorOccurred += new EventHandler<Renci.SshNet.Common.ExceptionEventArgs>(client_ErrorOccurred);

                this.client.Connect();

                var response = new MemoryStream();
                this.client.DownloadFile(this.intraDayFilePath, response);


                this.client.Disconnect();
            }
I'm quite sure this has nothing to do with either this code, or the library, but with running this over Azure itself. Hopefully someone has experienced this or has some ideas. Cheers.

Edit to include the full exception:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.xxx.xxx.xxx:22

   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at Renci.SshNet.Session.SocketConnect(String host, Int32 port)
   at Renci.SshNet.Session.Connect()
   at Renci.SshNet.BaseClient.Connect()
   at ---------
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()