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

发布于 2024-09-03 01:33:39 字数 259 浏览 3 评论 0原文

我有一个无法修改的 ASP.NET Web 应用程序(我只有二进制文件)。此应用程序连接到 Web 服务,并且似乎连接已从客户端(我的 Web 应用程序)关闭。我增加了目标服务器的 machine.config 中的“executionTimeout”,但我的网络应用程序似乎在等待一段时间后仍然停止。

有没有办法通过简单地修改 web.config 来增加我的 Web 应用程序的超时时间?正如我所说...我无法修改代码中的超时,因此我唯一的选择是通过配置文件。

谢谢!

I have an ASP.NET web application that I can't modify (I only have the binaries). This application connects to a web service and it seems like the connection is closed from the client side (my web app). 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.

Is there a way to increase the timeout time for my web application by simply modifying the web.config? As I said... I can't modify the timeout in the code so my only option would be through config files.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

〃安静 2024-09-10 01:33:39

尝试一下这是否适合您。

首先,您需要增加 httpRuntime 元素的executionTimeout 属性的超时时间。请注意,与会话超时等其他超时属性不同,这是以秒为单位提到的。

<httpRuntime 
    executionTimeout="36000"

而且,只有当您将 Compilation 元素的 debug 属性设置为 false 时,该属性才会生效。您提到的 MSDN 链接中也指定了这一点。就像,

<compilation 
   debug="false" 
../>

但这与会话超时一起工作。是的,如果会话超时,则会抛出错误。并且它不会等待executionTimeout 值生效。因此您还需要将会话超时设置为更高的值。请注意,这是在几分钟内。看起来像,

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

并注意所有这些都将被 AppPool 回收过程覆盖。因此,您需要将网站使用的应用程序池的空闲超时值设置为至少与会话超时相同/更高的值。

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

Try if this would work for you.

Firstly, you need to increase the timeout of the executionTimeout attribute of the httpRuntime element. Note that this is mentioned in Seconds unlike the other timeout attributes like the Session timeout and others.

<httpRuntime 
    executionTimeout="36000"

And moreover, this attribute takes effect only when you set the debug attribute of the Compilation element to false. This is also specified in the MSDN link that you mentioned. 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. so you also need to set the Session Timeout to a higher value. 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. 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.

I found it here http://www.eggheadcafe.com/community/aspnet/17/10111748/how-can-we-increase-the-t.aspx

幸福还没到 2024-09-10 01:33:39

Web 应用程序的默认超时为 90 秒,通常足以满足一般用途。重要的是要注意超时的来源。是页面本身造成的还是页面中的某些内容造成的。无论哪种情况,“页面”都会出现超时。

我偶然发现了这个问题,因为我的页面也超时了。发现异常来自 SQL(读取实际错误),所以这确实是 SQL 问题。一旦我知道了,我就可以轻松修复它。

The default timeout of web application is 90 seconds which is usually more than enough for general purpose use. 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. Once I knew it, I could easily fix it.

嘿咻 2024-09-10 01:33:39

在 web.config 文件中

<binding name="endpointname" sendTimeout="00:3:00" />

这会将超时属性更新为 3 分钟

In web.config file

<binding name="endpointname" sendTimeout="00:3:00" />

This will update timeout property to 3 minutes

送舟行 2024-09-10 01:33:39

就我而言,我有一个 VB.NET 桌面应用程序,其中配置了 asmx 服务。超时错误发生在某些国家/地区,有时也发生在某些 ISP 上。

问题是我对 asmx 请求使用 http 特定 URL。当我将asmx服务引用的URL中的http更改为https时,问题解决了。

In my Case, I have a VB.NET Desktop application with asmx service configured in it. The timeout error occurred from some countries and sometimes from some ISPs.

The problem was that I was using http specific URL for the asmx request. When I changed http to https in the URL of asmx service reference, the problem solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文