How can I programmatically determine if an IIS site is receiving requests?

The name says a lot about everything. Some reservations:

  • I need to be able to do this in C #
  • It must be executed from a remote server (i.e. it works on one server, checks IIS on another)
  • Need to be close to real time (within 1 second)
  • May use WMI calls

I tried to look at the log file, but it turns out that it is almost not close to real time.

Thanks!

EDIT: I put this in a comment on Tom's answer, but it is more noticeable here:

I managed to find the changes using this counter:

var perf = new PerformanceCounter("ASP.NET Apps v2.0.50727", "Requests Total", "_LM_W3SVC_[IIS-Site-ID]_ROOT", "[Server-Name]"); 
+6
c # iis wmi
source share
1 answer

How about reading an ASP.NET/sec performance counter on a remote computer?

There is a constructor in the System.Diagnostics.PerformanceCounter class that takes the name of the machine.

+4
source share

All Articles