我在本地的winform中调用部署在另一台机器上的一个webservice,第一次调用时正常,但从第二次开始就产出异常,如下:
Server Error in '/' Application.
Request timed out.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Request timed out.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
[HttpException (0x80004005): Request timed out.] |
我在网上查了下,发现很多的说法,如
在web.config中加入
<webServices>
<protocols>
<add name="HttpSoap"/>
<add name="HttpPost"/>
<add name="HttpGet"/>
<add name="Documentation"/>
</protocols>
</webServices>
或
1.iis->[网站]->属性-》连接超时。默认为120秒
2.web.config 手工添加httpruntime,如
<system.web>
<httpruntime executiontimeout="2000" />
</system.web>
3.同步执行webservice时,设置timeout属性
或
windows应用程序所参照的webservice的Reference.cs文件中,添加下列代码
using System.Net;
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);
webRequest.KeepAlive = false;
webRequest.ProtocolVersion = HttpVersion.Version10;
return webRequest;
}
以上方法都试过了,但还是产生上述异常。
请高手指教。
MMTTMM
汪汪一只猫
MYYA
炎炎设计
慕容3067478
翻过高山走不出你
慕桂英3389331
天涯尽头无女友
临摹微笑