hello朋友, 我打電話給1個來自Windows 8 Store應用的rest服務,該服務託管在wamp服務器上,返回JSon數據。當我輸入從我的瀏覽器的URL它顯示正確的JSON數據,但每當我嘗試使用HttpClient的通過代碼來調用,它拋出一個異常「An attempt was made to access a socket in a way forbidden by its access permissions 192.168.2.161:8080
」調用Rest服務時出錯「無法連接到遠程服務器」
堆棧跟蹤:在System.Net.Sockets.Socket.EndConnect(IAsyncResult的 asyncResult)at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4,Socket s6,Socket & soc KET,ip地址&地址, ConnectSocketState狀態,IAsyncResult的asyncResult,異常& 除外)
try
{
HttpClient http = new System.Net.Http.HttpClient();
HttpResponseMessage response = await http.GetAsync("http://192.168.2.161:8080/Demo/?q=lgwebservice/Demo-Services");
string res = response.Content.ToString();
}
catch(Exception ex)
{}
192.168.2.161看起來像一個看起來像本地地址是通過用意何在? –
是.. 。實際上2.161系統是在局域網上安裝的所有wamp服務器和服務都只在該系統上託管.. –
它是否對ping進行響應? –