尝试使用此URL可以更好地了解我的问题
http://api.oodle.com/api/v2/listings?key=TEST®ion=chicago&category=vehicle/car
try { string url = @"http://API.oodle.com/API/v2/Listings?key=TEST®ion=chicago"; WebClIEnt webClIEnt = new WebClIEnt(); webClIEnt.EnCoding = EnCoding.UTF8; string result = webClIEnt.DownloadString(url); } catch (Exception ex) { Response.Write(ex.ToString()); }
该语句创建异常
string result = webClIEnt.DownloadString(url);
和例外细节是
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 192.168.0.101:808 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,Int32 timeout,Exception& exception) --- End of inner exception stack trace --- at System.Net.WebClIEnt.DownloadDataInternal(Uri address,WebRequest& request) at System.Net.WebClIEnt.DownloadString(Uri address) at System.Net.WebClIEnt.DownloadString(String address) at _Default.lnkGoTo_Click(Object sender,EventArgs e) in d:\MyDemoz\oodleDemo\Default.aspx.cs:line 58总结
以上是内存溢出为你收集整理的c# – 无法连接远程服务器(Web服务)全部内容,希望文章能够帮你解决c# – 无法连接远程服务器(Web服务)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)