我可以更改 ASP.NET 中单个页面的网页超时阈值吗?

发布于 2024-08-21 04:22:49 字数 549 浏览 2 评论 0原文

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

当然,上线后,我们发现部分用户数据量过多,导致报表运行缓慢,甚至出现超时。

从长远来看,我们将通过创建一个页面来解决这个问题,该页面定期查找已完成的报告,并在准备好时加载它。但就目前而言,如果可能的话,我们希望能够快速解决眼前的问题。

有没有办法延长单个网页的超时时间?

我发现这个似乎表明这是可能的(但这似乎是一个非常糟糕的主意,因为它在网络调用期间更改了整个网站,更糟糕的是,它似乎也可能存在多次点击同步问题,可能会留下整个网站的超时时间更长)

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

We've got a report that is being generated and served in real time when a user clicks on a link.

Of course, after we go live, we've discovered that some users have enough data to cause the report to run slowly enough that there is a timeout.

Longer term, we'll solve this by just creating a page that looks for the completed report periodically, and loads it up when it's ready. But for now, if it's possible, we'd like a quick fix to solve the immediate problem.

Is there a way to extend the timeout period for the single webpage being served up?

I found this which seemed to indicate it was sort of possible (but which seems like a very bad idea, because it changes the entire website for the duration of the web call, and worse, it seems like it might have problems with multiple hit synchronization as well, possibly leaving the longer timeout on for the entire site)

I also found this locally, but it didn't end up answering the question (though it did offer the longer term solution that we'll be moving toward.)

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

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

发布评论

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

评论(1

静谧 2024-08-28 04:22:50

如果页面位于(或可以移动到)其自己的目录中,则可以将 web.config 放入该目录中,仅包含executionTimeout 或您想要扩展的任何其他设置。即

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

根据 第一个链接的评论者之一您提供的,设置 Server.ScriptTimeout = 3600; 不是全局更改,因此您可能还需要重新考虑该选项。

Gerald 撰写了re:ASP.NET 超时
页面

2006 年 11 月 29 日星期三下午 3:38

决定检查此内容的有效性
通过编写包含以下内容的测试程序
两页。在其中一页我
将 ScriptTimeout 属性设置为
3000,而在另一页中
财产的价值没有改变。
事实证明,加载后
第一页,然后是第二页,
中 ScriptTimeout 的值
第二页恢复为默认值
值(90秒释放,
30000000 用于调试)或设置的值
在配置文件中。在
结论,ScriptTimeout
属性,当在一页中更改时,
在全球层面上不会改变。

If the page is in (or can be moved to) its own directory, you can put a web.config in that directory with just the executionTimeout or any other settings you want to extend. I.e.

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

According to one of the commenters on the first link you provided, setting Server.ScriptTimeout = 3600; is not a global change, so you may want to reconsider that option as well.

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.

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