服务器端的Web服务问题-一段时间后连接方未正确响应 [英] Web Service from server side Problem - Connected Party did not Properly Respond After a Period of Time
本文介绍了服务器端的Web服务问题-一段时间后连接方未正确响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我从服务端调用Web服务并使用post方法返回字符串响应时,出现错误.我创建:
When I call web service from service side and return string response using post method I get an error. I create:
//1)
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
//2)
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postParameters.Length;
request.Method = method;
//3)
StreamWriter stOut = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII);
在第3位时出现错误:
and at 3rd position I got error:
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 116.66.162.16:443
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)
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.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at clsWebService.FetchesWebPageUsingHttpRequest(StringDictionary sd, String url, String method)
at clsCostSavingSimpleCalculator.CheckLogin()
请帮助我如何解决此问题
谢谢
------
Please help me how to solve this problem
thanks
------
推荐答案
Add following Tags in web.config in <webServices>
<protocols>
<clear/>
<add name="HttpGet"/>
<add name="HttpPost"/>
<add name="HttpSoap12"/>
<add name="HttpSoap"/>
<add name="HttpPostLocalhost"/>
<add name="Documentation"/>
</protocols>
这篇关于服务器端的Web服务问题-一段时间后连接方未正确响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文