真的希望你能协助我的查询。
我目前正在创建一个将 SFTP 服务器与 NetSuite 文件柜集成的应用程序。从我的机器(Windows 7)执行应用程序时,我的所有代码都可以正常工作,但是当我在服务器(Windows Server 2003)上执行此应用程序时,我遇到以下错误:
System.Net.Sockets.SocketException: 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 10.81.200.87:22
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at Tamir.SharpSsh.java.net.Socket..ctor(String host, Int32 port)
at Tamir.SharpSsh.jsch.Util.createSocket(String host, Int32 port, Int32 timeout)
我正在使用 SharpSSH 连接到 SFTP 服务器。
我为诊断此问题而执行的一些步骤:
- 我已经ping通了主机地址,它成功返回了所有数据包
使用移除证书限制
System.Net.ServicePointManager.ServerCertificateValidationCallback
如果不正确,我还使用了以下内容,
'\\'
我可以添加到主机地址:Dns.GetHostEntry(host);
事实上,我知道 Windows Server 2003 已经很老了,但我工作的企业没有升级它的计划,所以我只需要使用我所拥有的。当然,我不得不将应用程序降级到 .NET 3.5 框架以使其兼容。
任何有关解决此问题的帮助将不胜感激。
问候 AWB