Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: sftp behind proxy unable to connect

$
0
0
Hi Guys,

this may sound familiar but I am unable to get it to connect:

Exception:
at Renci.SshNet.Session.SocketReadLine(String& response)
at Renci.SshNet.Session.ConnectHttp()
at Renci.SshNet.Session.Connect()
at Renci.SshNet.BaseClient.Connect()
at FTPClient.ArchitasSFTPClient.DownLoadFiles() in c:\SFTPClient.cs:line 134
at FTPClientConsoleApp.Program.Main(String[] args) in c:\FTPClientConsoleApp\Program.cs:line 228
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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

and the code is:

var connectionInfoz = new ConnectionInfo(_ftpServer, PORT, _userName,
            ProxyTypes.Http, PROXYHOST, PROXY_PORT, _userName, _password,
            new AuthenticationMethod[] { new PasswordAuthenticationMethod(_userName, _password) })
            {
                Timeout = TimeSpan.FromMinutes(15)
            };

        using (var sftp = new SftpClient(connectionInfoz))
        {
            sftp.BufferSize = 1024;
            sftp.ConnectionInfo.Timeout = TimeSpan.FromMinutes(3);
            sftp.OperationTimeout = TimeSpan.FromMinutes(10);
            try
            {
                sftp.KeepAliveInterval = TimeSpan.FromMinutes(10);
                var connectionInfo = sftp.ConnectionInfo;
                Console.WriteLine(connectionInfo.Timeout);
                sftp.Connect(); // this line throws exception after waiting for 3 minutes

            }

            catch (ProxyException ex)
            {
                Console.WriteLine(ex.Message);
            }
}

I can connect to the site via WinSCP without any problems.

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>