如何为长时间运行的查询增加executionTimeout ?

时间:2022-09-03 20:03:34

In my application, one query takes 3 minutes to execute. I found that Default ExecutionTimeout value is 110 sec.I tried to change this to 500 (seconds) but it didn't fix my problem. Somewhere I found that setting <compilation debug="false"> allows the ExecutionTimeout property to be configured. However, even this didn't solve my problem.

在我的应用程序中,执行一个查询需要3分钟。我发现默认的ExecutionTimeout值是110秒,我试图将其更改为500秒(秒),但这并没有解决我的问题。在某个地方,我发现设置 <编译debug="false"> 允许配置ExecutionTimeout属性。然而,这并不能解决我的问题。

Does anyone know how I can increase the execution timeout for a long-running query?

有人知道我如何增加长时间运行的查询的执行超时吗?

6 个解决方案

#1


89  

Execution Timeout is 90 seconds for .NET Framework 1.0 and 1.1, 110 seconds otherwise.

. net Framework 1.0和1.1的执行超时为90秒,否则为110秒。

If you need to change defult settings you need to do it in your web.config under <httpRuntime>

如果您需要更改defult设置,则需要在web中进行。配置在< httpRuntime >

<httpRuntime executionTimeout = "number(in seconds)"/>

But Remember:

但是请记住:

This time-out applies only if the debug attribute in the compilation element is False.

此超时仅适用于编译元素中的debug属性为False的情况。

Have look at in detail about compilation Element

有没有仔细看过编译元素

Have look at this document about httpRuntime Element

查看过这个关于httpRuntime元素的文档吗

#2


18  

You can set executionTimeout in web.config to support the longer execution time.

可以在web中设置executionTimeout。配置以支持更长的执行时间。

executionTimeout specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET. MSDN

executionTimeout指定一个请求在ASP.NET自动关闭之前允许执行的最大秒数。MSDN

<httpRuntime  executionTimeout = "300" />

This make execution timeout to five minutes.

这使得执行超时为5分钟。

Optional Int32 attribute.

可选Int32属性。

Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.

指定请求在ASP.NET自动关闭之前允许执行的最大秒数。

This time-out applies only if the debug attribute in the compilation element is False. Therefore, if the debug attribute is True, you do not have to set this attribute to a large value in order to avoid application shutdown while you are debugging. The default is 110 seconds, Reference.

此超时仅适用于编译元素中的debug属性为False的情况。因此,如果debug属性为真,则不必将此属性设置为大值,以便在调试时避免应用程序关闭。默认是110秒,参考。

#3


7  

RE. "Can we set this value for individual page" – MonsterMMORPG.

再保险。“我们可以为单独的页面设置这个值吗?”——MonsterMMORPG。

Yes, you can (& normally should) enclose the previous answer using the location-tag.

是的,您可以(通常应该)使用位置标记包围前面的答案。

e.g.

如。

  ...
  <location path="YourWebpage.aspx">
    <system.web>
      <httpRuntime executionTimeout="300" maxRequestLength="29296" />
    </system.web>
  </location>
</configuration>

The above snippet is taken from the end of my own working web.config, which I tested yesterday - it works for me.

上面的代码片段取自我自己的工作web的结尾。配置,我昨天测试的-它对我有用。

#4


2  

When a query takes that long, I would advice to run it asynchronously and use a callback function for when it's complete.

当查询需要这么长的时间时,我建议异步运行它,并在查询完成时使用回调函数。

I don't have much experience with ASP.NET, but maybe you can use AJAX for this asynchronous behavior.

我对ASP没什么经验。NET,但是也许可以使用AJAX实现这种异步行为。

Typically a web page should load in mere seconds, not minutes. Don't keep your users waiting for so long!

通常一个web页面应该在几秒钟内加载,而不是几分钟。不要让你的用户等待太久!

#5


1  

in my case, I need to have my wcf running for more than 2 hours. Setting and did not work at all. The wcf did not execute longer than maybe 20~30 minutes. So I changed the idle timeout setting of application pool in IIS manager then it worked! In IIS manager, choose your application pool and right click on it and choose advanced settings then change the idle timeout setting to any minutes you want. So, I think setting the web.config and setting the application pool are both needed.

在我的情况下,我需要让wcf运行超过2小时。设置和根本不起作用。wcf的执行时间可能不超过20~30分钟。所以我更改了IIS管理器中应用程序池的空闲超时设置,然后它就工作了!在IIS管理器中,选择您的应用程序池并右击它并选择高级设置,然后将空闲超时设置更改为您想要的任何分钟。所以,我认为设置网络。配置和设置应用程序池都是必需的。

#6


1  

To set timeout on a per page level, you could use this simple code:

要在每个页面级别上设置超时,可以使用以下简单代码:

Page.Server.ScriptTimeout = 60;

Note: 60 means 60 seconds, this time-out applies only if the debug attribute in the compilation element is False.

注意:60表示60秒,此超时仅适用于编译元素中的调试属性为False。

#1


89  

Execution Timeout is 90 seconds for .NET Framework 1.0 and 1.1, 110 seconds otherwise.

. net Framework 1.0和1.1的执行超时为90秒,否则为110秒。

If you need to change defult settings you need to do it in your web.config under <httpRuntime>

如果您需要更改defult设置,则需要在web中进行。配置在< httpRuntime >

<httpRuntime executionTimeout = "number(in seconds)"/>

But Remember:

但是请记住:

This time-out applies only if the debug attribute in the compilation element is False.

此超时仅适用于编译元素中的debug属性为False的情况。

Have look at in detail about compilation Element

有没有仔细看过编译元素

Have look at this document about httpRuntime Element

查看过这个关于httpRuntime元素的文档吗

#2


18  

You can set executionTimeout in web.config to support the longer execution time.

可以在web中设置executionTimeout。配置以支持更长的执行时间。

executionTimeout specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET. MSDN

executionTimeout指定一个请求在ASP.NET自动关闭之前允许执行的最大秒数。MSDN

<httpRuntime  executionTimeout = "300" />

This make execution timeout to five minutes.

这使得执行超时为5分钟。

Optional Int32 attribute.

可选Int32属性。

Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.

指定请求在ASP.NET自动关闭之前允许执行的最大秒数。

This time-out applies only if the debug attribute in the compilation element is False. Therefore, if the debug attribute is True, you do not have to set this attribute to a large value in order to avoid application shutdown while you are debugging. The default is 110 seconds, Reference.

此超时仅适用于编译元素中的debug属性为False的情况。因此,如果debug属性为真,则不必将此属性设置为大值,以便在调试时避免应用程序关闭。默认是110秒,参考。

#3


7  

RE. "Can we set this value for individual page" – MonsterMMORPG.

再保险。“我们可以为单独的页面设置这个值吗?”——MonsterMMORPG。

Yes, you can (& normally should) enclose the previous answer using the location-tag.

是的,您可以(通常应该)使用位置标记包围前面的答案。

e.g.

如。

  ...
  <location path="YourWebpage.aspx">
    <system.web>
      <httpRuntime executionTimeout="300" maxRequestLength="29296" />
    </system.web>
  </location>
</configuration>

The above snippet is taken from the end of my own working web.config, which I tested yesterday - it works for me.

上面的代码片段取自我自己的工作web的结尾。配置,我昨天测试的-它对我有用。

#4


2  

When a query takes that long, I would advice to run it asynchronously and use a callback function for when it's complete.

当查询需要这么长的时间时,我建议异步运行它,并在查询完成时使用回调函数。

I don't have much experience with ASP.NET, but maybe you can use AJAX for this asynchronous behavior.

我对ASP没什么经验。NET,但是也许可以使用AJAX实现这种异步行为。

Typically a web page should load in mere seconds, not minutes. Don't keep your users waiting for so long!

通常一个web页面应该在几秒钟内加载,而不是几分钟。不要让你的用户等待太久!

#5


1  

in my case, I need to have my wcf running for more than 2 hours. Setting and did not work at all. The wcf did not execute longer than maybe 20~30 minutes. So I changed the idle timeout setting of application pool in IIS manager then it worked! In IIS manager, choose your application pool and right click on it and choose advanced settings then change the idle timeout setting to any minutes you want. So, I think setting the web.config and setting the application pool are both needed.

在我的情况下,我需要让wcf运行超过2小时。设置和根本不起作用。wcf的执行时间可能不超过20~30分钟。所以我更改了IIS管理器中应用程序池的空闲超时设置,然后它就工作了!在IIS管理器中,选择您的应用程序池并右击它并选择高级设置,然后将空闲超时设置更改为您想要的任何分钟。所以,我认为设置网络。配置和设置应用程序池都是必需的。

#6


1  

To set timeout on a per page level, you could use this simple code:

要在每个页面级别上设置超时,可以使用以下简单代码:

Page.Server.ScriptTimeout = 60;

Note: 60 means 60 seconds, this time-out applies only if the debug attribute in the compilation element is False.

注意:60表示60秒,此超时仅适用于编译元素中的调试属性为False。