繁体   English   中英

无法在http请求中连接到远程服务器

[英]Unable to connect to the remote server in a http request

我使用的这个文章来获取雅虎contacts.It是OK,给我一个guid.Then我创建一个请求http://social.yahooapis.com/v1/user/给定guid.But时,我想读来自http请求的响应,我收到一条错误消息:

Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:8555
   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, Exception& exception)

问题是什么?

“主动拒绝”表示您尝试连接时主机发送了重置而不是确认。 因此,这不是您的代码中的问题。 可能是防火墙阻止了连接,或者是承载服务的进程未在该端口上侦听,这可能是因为它根本没有在运行,或者是因为它在侦听其他端口。

一旦开始托管服务的进程,请尝试netstat -anb(需要管理员权限)以验证其是否正在运行并且正在侦听预期的端口。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM