asp.net - 是否可以在ASP.NET中更改单个页面的网页超时阈值?

标签 asp.net timeout

当用户单击链接时,我们会实时生成并提供报告。

当然,在上线之后,我们发现一些用户有足够的数据来导致报告运行得足够慢,从而导致超时。

从长远来看,我们将通过创建一个页面来定期解决已完成的报告,并在准备好后将其加载来解决此问题。但是目前,如果可能的话,我们希望快速解决此紧急问题。

有没有一种方法可以延长单个网页的超时时间?

我发现this似乎表明这是有可能的(但是这似乎是一个非常糟糕的主意,因为它会在网络通话期间更改整个网站,而且更糟的是,它似乎在多次匹配同步方面可能存在问题同样,可能会使整个网站的超时时间更长)

我还在本地找到了this,但最终并没有回答这个问题(尽管它确实提供了我们将朝着的长期解决方案。)

最佳答案

如果页面在其自己的目录中(或可以移动到其目录中),则可以将web.config放到该目录中,其中只包含执行超时或您要扩展的任何其他设置。 IE。

<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
      <!-- allow for intensive calculations in reports -->
      <httpRuntime executionTimeout="6000" /> 
    </system.web>
</configuration>

根据first link you provided上的一位评论者说,设置Server.ScriptTimeout = 3600;不是全局更改,因此您可能还需要重新考虑该选项。

Gerald wrote re: Timeout of an ASP.NET page
on Wed, Nov 29 2006 3:38 PM
I decided to check the validity of this by writing a test program containing two pages. In one of the pages I am setting the ScriptTimeout property to 3000, while in the other page the value of the property is not changed. It turns out that after loading the first page, then the second page, the value of the ScriptTimeout in the second page is reverted to its default value (90 seconds for release, 30000000 for debug) or the value set in the configuration files. In conclusion, the ScriptTimeout property, when changed in one page, does not change at a Global level.

关于asp.net - 是否可以在ASP.NET中更改单个页面的网页超时阈值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2238838/

相关文章:

C# NetworkStream.Read 奇数

c# - 页面 .aspx 中的 Windows.Forms.MessageBox

javascript - 使用 asp.net 和 jQuery 的 GridView 索引

Python请求异常超时

java - 如何防止 Java 中的 SocketInputStream.socketRead0 挂起?

c# - 尝试使用 WebClient 下载 URL 中包含 ':' 的文件

c# - 在 C# 中管理键值对的最佳方法

ajax - 超时期间的 fiddler 行为

javascript - 设置最短时间和超时

java - MYSQL超时