Session.Timeout 和 Server.ScriptTimeout 之间有什么区别?

发布于 2024-07-14 21:25:18 字数 439 浏览 7 评论 0原文

我们有一个 ASP.net Web 应用程序,其中有几个页面在加载时偶尔会超时(通常,这些都是管理类型的页面,会在处理过程中进行上传/下载错误。)

解决方案之一是碰撞Session.Timeout 和 Server.ScriptTimeout 都达到非常大的数字 - 效果很好。 然而,这里有很多关于每种设置何时适用的讨论。 温和地说,MSDN 页面是可以解释的。

任何人都可以给我读者摘要版本的差异是什么,或者给我指出我们找不到的 MSDN 页面吗?

谢谢大家。

(II6 上的 .net 2.0,如果重要的话。)

作为一个额外的后续问题,例如,在给定页面的 on_load() 函数中更改这些设置是否会更改整个应用程序或仅该页面的设置?

编辑:哎呀! 我的意思是“Session.Timeout”而不是“Server.Timeout”。

We've got a ASP.net web app with a few pages that occasionally time out as the page loads (generally, these are all admin-type pages that do bug uploads / downloads with processing.)

One of the solutions has been to bump both Session.Timeout and Server.ScriptTimeout up to very large numbers - which works fine. However, there's quite a bit of discussion here about when each setting applies. To put it mildly, the MSDN pages are open to interpretation.

Can anyone give me the reader's digest version of what the difference is, or point me to the MSDN page we couldn't find?

Thanks, all.

(.net 2.0 on II6, if it matters.)

As a bonus follow-up question, does changing those settings in, say, a given page's on_load() function change them for the whole app, or just that page?

Edit: whoops! I meant "Session.Timeout" not "Server.Timeout."

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

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

发布评论

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

评论(2

孤君无依 2024-07-21 21:25:18

脚本超时控制代码可以运行多长时间来处理请求,因此您可以更改它以允许长时间运行代码。 IIS 管理器中的设置用于每个请求,而 Server.ScriptTimeout 属性用于当前请求,因此如果可能,您应该在代码中设置它,以便所有常规页面都使用正常的脚本超时。

会话超时是指用户最后一次发出请求后,服务器上的会话对象存活的时间。 IIS 管理器中的会话超时设置是创建的任何新会话的默认设置,并且您从代码访问的 Session.Timeout 属性是该特定会话的超时。 默认会话超时为 20 分钟,您可以将其调高一点,不会有太大风险,但您仍应将其保持在合理的值内,以免会话对象在内存中保留数天。

The script timeout is what controls how long the code may run to handle a request, so that's what you change to allow for long running code. The setting in IIS Manager is used for every request, and the Server.ScriptTimeout property is used for the current request, so if possible you should set it in the code so that all the regular pages uses the normal script timeout.

The session timeout is the time that the session object on the server survives after the user last made a request. The session timeout setting in IIS Manager is the default setting for any new session created, and the Session.Timeout property that you access from the code is the timeout for that specific session. The default session timeout is 20 minutes, and you can bump it up a bit without any great risk, but you should still keep it within a reasonable value so that you don't have session objects that clings on for days in memory.

短暂陪伴 2024-07-21 21:25:18

ScriptTimeout 是 ASP.NET 运行时等待 ASPX 页面结果所花费的秒数。

Session.Timeout 是 ASP.NET 等待您的分钟数。

ScriptTimeout is the number of seconds the ASP.NET runtime will spend waiting on results from an ASPX page.

Session.Timeout is the number of minutes ASP.NET will spend waiting on YOU.

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