连接尝试失败,因为一段时间后连接方未正确响应或连接的主机未能响应 [英] A connection attempt failed because the connected party did not properly respond after a period of time or connected host has failed to respond

查看:705
本文介绍了连接尝试失败,因为一段时间后连接方未正确响应或连接的主机未能响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Windows服务,该服务从特定的URL下载图像.该服务可以在我的计算机上正常运行,但是当我在服务器上安装该服务时,它不会下载该映像,并且会出现以下错误:

I'm developing a windows service, that downloads images from a specific URL. The service runs correctly on my computer but when I install it in the server it does not download the image and it gives the following error:

System.Net.WebException:无法连接到远程服务器---> System.Net.Sockets.SocketException:连接尝试失败,因为一段时间后连接方未正确响应,或者建立连接失败,因为连接的主机未能响应212.100.220.117:80

System.Net.WebException: Unable to connect to the remote server ---> 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 212.100.220.117:80

在System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)

at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

在System.Net.ServicePoint.ConnectSocketInternal(布尔型connectFailure,Socket s4,Socket s6,Socket&套接字,IPAddress&地址,ConnectSocketState状态,IAsyncResult asyncResult,Int32超时,Exception&异常)

at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)

-内部异常堆栈跟踪的结尾---

--- End of inner exception stack trace ---

System.Net.WebClient.DownloadDataInternal上的

(URI地址,WebRequest& request) 在System.Net.WebClient.DownloadData(Uri地址) 在System.Net.WebClient.DownloadData(字符串地址)

at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) at System.Net.WebClient.DownloadData(Uri address) at System.Net.WebClient.DownloadData(String address)

可能是什么原因导致该错误,我该如何解决? 我阅读了此页面: http://support.microsoft.com/kb/318140

What might be causing the error and how can I resolve it? I read this page: http://support.microsoft.com/kb/318140

但是我不确定这是否是问题,是否应该在配置中编写哪个代理.询问您的建议.

but I'm not sure if this is the problem, and if it is what proxy should I write in the config. Asking you for your advice.

谢谢

推荐答案

我找到了答案.我试图从服务器访问公用地址" http://mywebsite.com/images/" .取而代之的是,我使用托管网站的服务器的本地IP来运行它.

I found the answer. I was trying to access the public address "http://mywebsite.com/images/" from the server. Instead of that I used the local IP of the server hosted the website and it's now working.

这篇关于连接尝试失败,因为一段时间后连接方未正确响应或连接的主机未能响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆