从 IIS 7 检索活动会话信息

发布于 2024-08-21 19:21:08 字数 363 浏览 2 评论 0原文

我正在运行多个具有 InProc 会话状态的 ASP.NET 网站,并且我想检索每个网站的活动会话数以及每个会话的任何详细信息(例如客户端连接详细信息)。 我的最终目标是能够查看谁连接到该网站,以便我可以在部署更新时通知他们。

有没有什么方法可以在.NET 中做到这一点而不诉诸 SQL 会话状态?我查看了 Microsoft.Web.Administration 但找不到方法。 perfmon 中的“Sessions Active”性能计数器仅提供整个服务器的总会话数(并且不提供有关会话的任何元数据)。

编辑:在我对性能计数器的测试中,我对总活动会话进行了测试,而我应该对我的网站的活动会话实例进行测试。这让我更接近了一点,但如果可能的话,我仍然想实际检索网站的会话信息。

I'm running several ASP.NET web sites with InProc session state and I would like to retrieve the number of active sessions per web site and hopefully any details around each session (eg client connection details).
My end goal is to be able to see who is connected to the web site so that I can notify them when deploying an update.

Is there any way to do this in .NET without resorting to SQL session state? I looked at Microsoft.Web.Administration but couldn't find a way to do it. And the "Sessions Active" performance counter in perfmon just gives the total sessions for the whole server (as well as not giving any metadata about the sessions).

EDIT: In my tests with performance counters I tested with total Sessions Active when I should have tested with the instance of Sessions Active for my web site. This gets me a little closer but I'd still like to actually retrieve the session information for the web site if possible.

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

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

发布评论

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

评论(1

仙女 2024-08-28 19:21:08

会话是一个概念,而不是现实。您可以使用 asp.net global.asax 伪事件进行会话开始/结束来跟踪这个概念,但它仍然只是一个近似值。我认为最好的选择是打开“正在进行维护”标志,并将一些内容放入请求管道中,以处理所有传入请求。

不知道你会如何/做什么,但我认为你将在这里滚动一些自定义代码。

Session is a concept, not an actuality. You can use the asp.net global.asax pseudo events for session start/end to track this concept but it will still only be an approximation. I think your best bet is to flip on your "maintenance in progress" flag and put something in the request pipeline that handles it for all incoming requests.

Not sure how/what you would do with this but I think you're going to be rolling some custom code here.

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