限制 IIS7 中的 asp.net 会话
有没有办法限制 IIS7 中的 asp.net(进程内)会话数量?我正在考虑允许经典 asp 的现有设置。基本上,我们希望能够限制服务器上的并发会话数量,并在达到限制后将其他流量重定向到“我们很忙”类型的页面。在以前的系统(经典 asp)上,我们通过将 503 响应重定向到保留页面来完成此操作。
我意识到这可能可以从 ASP.NET 代码中完成,但要监视会话启动和会话启动。结局并不理想。是否有 IIS 的扩展可以限制会话,或者可能是一个可以使用任何 Perfmon 计数器的灵活扩展?
非常感谢。
Is there a way of limiting the number of asp.net (in-process) sessions from within IIS7? I am thinking along the lines of the existing setting that allows this for classic asp. Basically we want to be able to limit the number of concurrent sessions on a server and once reached redirect other traffic to a "we are busy" type page. On previous systems (classic asp) we have done this by redirecting the 503 response to a holding page.
I realise this could potentially be done from within the asp.net code but monitoring the session start & ends isn't ideal. Is there an extension for IIS that could limit the sessions, or maybe one that is flexible that can use any Perfmon counter?
Many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有办法通过配置任何会话状态配置设置来立即执行此操作。
您可以编写自己的提供程序来执行此操作:
该示例使用 SQL,但您可以修改为创建您自己的内存存储。
在会话状态提供程序级别限制会话可能不是解决此问题的最佳方法。您将遇到的问题是,当您的网站已达到可用会话数量上限,但访问者数量却下降时。由于存在会话状态超时,因此将会有未使用的会话状态实例,并且在这些会话超时之前,您无法接受更多访问者。如果您的超时设置为默认值(20 分钟)并且有 20 或 30 个用户“离开”,那么您需要 20 分钟才能接受新会话。
There isn't a way to do this out of the box by configuring any Session State configuration settings.
You could write your own provider to do this:
The example uses SQL but you could modify to create your own in-memory store.
Limiting sessions at the Session State provider level may not be the best way to tackle this problem. The problem you're going to encounter is when you have the scenario where your site has maxed out the number of available sessions but then you have a drop in visitors. Because there is a session state timeout there will be unused session state instances and until these sessions time out you can't accept any more visitors. If your timeout is set to the default (20 minutes) and 20 or 30 users "go away" then it'll be 20 minutes before you can accept new sessions.