无法在http请求中连接到远程服务器 [英] Unable to connect to the remote server in a http request

查看:497
本文介绍了无法在http请求中连接到远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用可以获取Yahoo联系人的文章.可以,给我一个Guid.然后我使用给定的Guid创建一个对http://social.yahooapis.com/v1/user/的请求.但是,当我想从http请求中读取响应时,收到一条错误消息:

I am using this article to fetch yahoo contacts.It is OK and gives me a guid.Then I create a request to http://social.yahooapis.com/v1/user/ with the given guid.But when I want to read the response from the http request I receive an error that says:

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)

出什么问题了?

推荐答案

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

"Actively refused it" means that the host sent a reset instead of an ack when you tried to connect. It is therefore not a problem in your code. Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that port, this may be because it is not running at all or because it is listening on a different port.

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

once you start the process hosting your service try netstat -anb (requires admin privileges) to verify that it is running and listening on the expected port.

这篇关于无法在http请求中连接到远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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