使用 StateServer 时如何查找活跃用户数

发布于 2024-07-08 06:56:24 字数 130 浏览 7 评论 0原文

当你使用 StateServer 时,如何找出活跃用户的数量? 还可以查询 StateServer 并检索会话状态中的内容吗?

我知道如果您使用 SqlServer 作为后备存储,这一切都是可能的,但我希望它们位于内存中。

How can you find out the number of active users when you're using a StateServer? Also is it possible to query the StateServer and retrieve the contents in the Session State?

I know that this is all possible if you use SqlServer for a backing store, but I want them to be in memory.

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

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

发布评论

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

评论(2

回忆凄美了谁 2024-07-15 06:56:24

状态服务器中的活动会话数可以通过运行状态服务器的服务器上的性能计数器轻松查看。 这并不直接等同于活动用户(由于会话超时时间)

活动会话的计数器为:“Asp.net”-“State Server Sessions Active”

作为参考,这里是所有与 State Server 相关的 perfmon 计数器,来自 http://msdn.microsoft.com/en-us/library/fxk122b4.aspx

状态服务器会话被放弃
已明确放弃的用户会话数。 这些会话是由特定用户操作(例如关闭浏览器或导航到另一个站点)结束的。 此计数器仅在运行状态服务器服务 (aspnet_state) 的计算机上可用。

状态服务器会话处于活动状态
当前活动用户会话的数量。 此计数器仅在运行状态服务器服务 (aspnet_state) 的计算机上可用。

状态服务器会话超时
由于用户不活动而变得不活动的用户会话数。 此计数器仅在运行状态服务器服务 (aspnet_state) 的计算机上可用。

状态服务器会话总数
进程生命周期内创建的会话数。 该计数器是“活动状态服务器会话”、“放弃状态服务器会话”和“超时状态服务器会话”的总和。 此计数器仅在运行状态服务器服务 (aspnet_state) 的计算机上可用。

The number of active sessions in the State Server can be viewed with a Performance Counter on the server running the State Server easily. This does not directly equate to active users (due to session timeout time)

The counter for active sessions is: "Asp.net" - "State Server Sessions Active"

For reference, here are all State Server related perfmon counters, from http://msdn.microsoft.com/en-us/library/fxk122b4.aspx

State Server Sessions Abandoned
The number of user sessions that have been explicitly abandoned. These are sessions that are ended by specific user actions, such as closing the browser or navigating to another site. This counter is available only on the computer where the state server service (aspnet_state) is running.

State Server Sessions Active
The number of currently active user sessions. This counter is available only on the computer where the state server service (aspnet_state) is running.

State Server Sessions Timed Out
The number of user sessions that have become inactive through user inaction. This counter is available only on the computer where the state server service (aspnet_state) is running.

State Server Sessions Total
The number of sessions created during the lifetime of the process. This counter is the total value of State Server Sessions Active, State Server Sessions Abandoned, and State Server Sessions Timed Out. This counter is available only on the computer where the state server service (aspnet_state) is running.

ゃ人海孤独症 2024-07-15 06:56:24

跟踪用户数量需要在应用程序级别完成,而不是会话级别。

您应该能够通过以下内容查看当前会话中的内容:

StringBuilder builder = new StringBuilder();
foreach ( String key in Session.Contents ) {
    builder.AppendFormat("{0}: {1}<br />", key, Session[key]);
}
Response.Write(builder.ToString());

Tracking the number of users would need to be done at the application level, not the session level.

You should be able to see what is currently in the session with the following:

StringBuilder builder = new StringBuilder();
foreach ( String key in Session.Contents ) {
    builder.AppendFormat("{0}: {1}<br />", key, Session[key]);
}
Response.Write(builder.ToString());
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文