【发布时间】:2015-10-20 06:02:13
【问题描述】:
我在下载文件时遇到问题。我正在使用 webclient 下载文件。该代码在本地运行良好,但在 Windows Server 2008 中无法正常运行。我收到错误
[Download File] Error: Download failed: Unable to connect to the remote server
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 125.7.64.41:8888
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
这是我的代码。
string url = "https://test.openseas.wlcl.com.au:8888/cruise/PA/priceSummary?AgentId=DIRECTAU&format=xml";
WebClient mySSISWebClient = new WebClient();
mySSISWebClient.Credentials = new NetworkCredential();
mySSISWebClient.Credentials = new NetworkCredential("username", "password");
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
mySSISWebClient.Encoding = Encoding.Unicode;
// To save the file (and replace the existing file)
mySSISWebClient.DownloadFile(url , Dts.Variables["User::LocalSourceFile"].Value.ToString())
请任何人帮助我为什么我在 Windows Server 20087 中遇到此错误,我应该怎么做才能使它工作。谢谢
【问题讨论】:
-
该错误通常表明没有 Web 服务器在指定的 IP 地址和端口进行侦听,或者 Web 服务器配置为仅接受来自某些计算机的连接。
-
但这在本地计算机上运行良好,即使我在家也很累,它运行良好,但不是从我上传它的服务器和它的 windows server 2008 @HarryJohnston
-
如果本地防火墙配置为不允许传出连接,您可能会收到相同的错误消息,我不确定。
-
是的,我检查了防火墙,它已关闭:/ @HarryJohnston
-
尝试重新打开它。如果防火墙关闭,网络堆栈有时会在 Windows Server 上做一些有趣的事情。
标签: c# .net ssis c#-3.0 windows-server-2008