我可以更改 ASP.NET 中单个页面的网页超时阈值吗?
当用户点击链接时,我们会实时生成并提供一份报告。
当然,上线后,我们发现部分用户数据量过多,导致报表运行缓慢,甚至出现超时。
从长远来看,我们将通过创建一个页面来解决这个问题,该页面定期查找已完成的报告,并在准备好时加载它。但就目前而言,如果可能的话,我们希望能够快速解决眼前的问题。
有没有办法延长单个网页的超时时间?
我发现这个似乎表明这是可能的(但这似乎是一个非常糟糕的主意,因为它在网络调用期间更改了整个网站,更糟糕的是,它似乎也可能存在多次点击同步问题,可能会留下整个网站的超时时间更长)
我还在本地找到了这个,但它没有'最终回答了这个问题(尽管它确实提供了我们将采取的长期解决方案。)
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果页面位于(或可以移动到)其自己的目录中,则可以将 web.config 放入该目录中,仅包含executionTimeout 或您想要扩展的任何其他设置。即
根据 第一个链接的评论者之一您提供的,设置
Server.ScriptTimeout = 3600;
不是全局更改,因此您可能还需要重新考虑该选项。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.
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.