简体   繁体   English

如何增加Web服务请求的超时?

[英]How to increase the timeout to a web service request?

I have an ASP.NET web application that I can't modify (I only have the binaries). 我有一个我无法修改的ASP.NET Web应用程序(我只有二进制文件)。 This application connects to a web service and it seems like the connection is closed from the client side (my web app). 此应用程序连接到Web服务,似乎连接从客户端(我的Web应用程序)关闭。 I have increased the "executionTimeout" in the machine.config of the destination server but my web app seems to still stop after waiting for a while. 我已经增加了目标服务器的machine.config中的“executionTimeout”,但是等待一段时间后我的网络应用程序似乎仍然停止。

Is there a way to increase the timeout time for my web application by simply modifying the web.config? 有没有办法通过简单地修改web.config来增加我的Web应用程序的超时时间? As I said... I can't modify the timeout in the code so my only option would be through config files. 正如我所说...我不能修改代码中的超时,所以我唯一的选择是通过配置文件。

Thanks! 谢谢!

Try if this would work for you. 试试这是否适合你。

Firstly, you need to increase the timeout of the executionTimeout attribute of the httpRuntime element. 首先,您需要增加httpRuntime元素的executionTimeout属性的超时。 Note that this is mentioned in Seconds unlike the other timeout attributes like the Session timeout and others. 请注意,这在Seconds中提到,与其他超时属性(如会话超时等)不同。

<httpRuntime 
    executionTimeout="36000"

And moreover, this attribute takes effect only when you set the debug attribute of the Compilation element to false. 而且,只有将Compilation元素的debug属性设置为false时,此属性才会生效。 This is also specified in the MSDN link that you mentioned. 这也在您提到的MSDN链接中指定。 Like, 喜欢,

<compilation 
   debug="false" 
../>

But this works in conjunction with the Session timeout. 但这与会话超时一起使用。 Yes, if the session times out , then an error would be thrown. 是的,如果会话超时,则会抛出错误。 and it wouldn't wait for the executionTimeout value to take effect. 并且它不会等待executionTimeout值生效。 so you also need to set the Session Timeout to a higher value. 所以你还需要将Session Timeout设置为更高的值。 And note that this is in minutes. 请注意,这只需几分钟。 which would look like, 看起来像,

<sessionState 
    mode="InProc" 
    timeout="360"
    ...
    />

And note that all of this would be overriden by AppPool recycling process. 请注意,所有这些都将被AppPool回收过程覆盖。 so you need to set the Idle Timeout value of the Apppool that your website uses to atleast same / higher value than the session timeout. 因此,您需要将您的网站使用的Apppool的空闲超时值设置为至少与会话超时相同/更高的值。

I found it here http://www.eggheadcafe.com/community/aspnet/17/10111748/how-can-we-increase-the-t.aspx 我在这里找到了http://www.eggheadcafe.com/community/aspnet/17/10111748/how-can-we-increase-the-t.aspx

The default timeout of web application is 90 seconds which is usually more than enough for general purpose use. Web应用程序的默认超时为90秒,这通常足以用于通用目的。 It is important to note where the timeout is coming from. 重要的是要注意超时的来源。 Is it from the page itself or something in the page that is causing it. 是来自页面本身还是页面中引起它的东西。 In either case, it would appear that the "the page" is timing out. 在任何一种情况下,似乎“页面”超时。

I stumbled upon this question as my page was timing out too. 我偶然发现了这个问题。 Found out the exception was coming from SQL (read the the actual error) so it was really SQL problem. 发现异常来自SQL(读取实际错误)所以它确实是SQL问题。 Once I knew it, I could easily fix it. 一旦我知道了,我就可以轻松解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM