2013-11-01 82 views
1

我使用this文章來獲取雅虎contacts.It是好的,並給我一個guid.Then我創建一個請求http://social.yahooapis.com/v1/user/與給定的guid.But當我想從http請求中讀取響應我收到一條錯誤消息:無法連接到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) 

問題是什麼?

+0

你連接到本地主機而不是遠程服務器,給我們代碼圍繞問題部分 –

回答

1

「主動拒絕它」意味着主機在嘗試連接時發送了重置而不是確認。因此它不是你的代碼中的問題。要麼有阻止連接的防火牆,要麼託管服務的進程不在該端口上偵聽,這可能是因爲它根本沒有運行,或者因爲它正在偵聽不同的端口。

一旦啓動託管服務的進程,請嘗試netstat -anb(需要管理員權限)以驗證它是否正在運行並正在偵聽預期的端口。

相關問題