首页 新闻 会员 周边

调用webservice第一次正常,以后就报异常: Request timed out

0
悬赏园豆:100 [已解决问题] 解决于 2010-05-07 13:41

我在本地的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; 
}


以上方法都试过了,但还是产生上述异常。

请高手指教。 


 


问题补充: 每次都是在调用webservice后,过了1分47秒、偶尔是1分50秒后产生异常。 虽然没有满意的回答,但还是要谢谢各位,每位都给了点分数,不要嫌少啊^_^ 这个问题我已经自己解决了,原来是<httpruntime>中少设置了shutdownTimeout,把<httpruntime>改为<httpRuntime shutdownTimeout="600" executionTimeout="600"/>就好了。
风雨如晦的主页 风雨如晦 | 初学一级 | 园豆:100
提问于:2010-04-30 19:07
< >
分享
最佳答案
0

用时超过一分钟?那不timeout才怪

1.检查你的服务器端是否出现什么异常

2.如果用了数据库,检查下数据库是否异常

收获园豆:20
蓝之风 | 菜鸟二级 |园豆:391 | 2010-05-01 01:10
其他回答(8)
0

能把你的WebService地址贴出来嘛?

收获园豆:10
上不了岸的鱼 | 园豆:4613 (老鸟四级) | 2010-04-30 20:39
公司内部网络的,不是公网的
支持(0) 反对(0) 风雨如晦 | 园豆:100 (初学一级) | 2010-04-30 20:48
0

你的web service完成什么功能?

收获园豆:10
邀月 | 园豆:25475 (高人七级) | 2010-05-01 00:58
0

连接超时了

收获园豆:10
查尔斯 | 园豆:3832 (老鸟四级) | 2010-05-01 12:38
0

直接在浏览器访问ws试试

收获园豆:10
小AI | 园豆:354 (菜鸟二级) | 2010-05-01 12:43
0

应该是连接数据库的问题。

收获园豆:10
好人好梦々 | 园豆:215 (菜鸟二级) | 2010-05-02 20:33
0

部署到远程服务器上试试!

收获园豆:10
Astar | 园豆:40805 (高人七级) | 2010-05-03 09:57
0

WF调用,改app.config 下的

receiveTimeout="02:01:00" sendTimeout="02:01:00"

<bindings>
            <basicHttpBinding>
                <binding name="ServiceSoap" closeTimeout="02:01:00" openTimeout="02:01:00"
                    receiveTimeout="02:01:00" sendTimeout="02:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>

收获园豆:10
千羽 | 园豆:666 (小虾三级) | 2010-05-04 08:35
0

连接的释放问题?

收获园豆:10
winzheng | 园豆:8797 (大侠五级) | 2010-05-05 23:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册