我怎么能在任何时候找到我的网站(IIS7 / asp.net)游客/用户数? [英] How can I find number of visitors/users at my site (IIS7/asp.net) at any given moment?

查看:186
本文介绍了我怎么能在任何时候找到我的网站(IIS7 / asp.net)游客/用户数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要显示有多少用户在浏览我的网站。该网站是在IIS7运行,我们正在使用asp.net 3.5。

I need to display how many users are browsing my site. The site is running on iis7, and we are using asp.net 3.5.

时的活动会话的数量的好方法去?
的数目不需要是非常准确的。

Is the number of active sessions a good way to go? The number does not need to be very accurate.

不需要历史,我只是想知道有多少用户是在线,现在,并显示在网页上。

No history is needed, I just want to know how many users are "online" right now, and display that on the page itself.

推荐答案

您可以使用Windows的性能计数器本(性能监视器)

You can use Windows Performance counters for this (perfmon)

ASP.NET应用程序>活动会话计数器。

ASP.NET Applications > Sessions Active counter.

您可以使用System.Diagnostics命名空间访问这些性能计数器。

You can access these performance counters using the System.Diagnostics namespace.

这code为我工作:

        PerformanceCounter pc = new PerformanceCounter("ASP.NET Applications",
     "Sessions Active", "__Total__", "MYSERVERHOSTNAME.domain");

        while (true)
        {
            Console.WriteLine(pc.NextValue());
            System.Threading.Thread.Sleep(1000);
        }

我如果计数器似乎太高这个问题,让到这里看看:的http://支持。 microsoft.com/kb/969722

这篇关于我怎么能在任何时候找到我的网站(IIS7 / asp.net)游客/用户数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆