Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get number of requests in IIS from c# code

Tags:

c#

iis

I am looking to get the number of requests that IIS currently has queued, programatically, in C#.

I'll also be looking to get the CPU usage as well...

Can anyone point me in the right direction?

like image 359
Howard Avatar asked Jan 24 '11 15:01

Howard


1 Answers

You will want to look at reading information from the performance counters of the system, depending on what you are looking for there are a number of counters that you can use.

This MSDN article shows all IIS6 performance counters there is a similar one for IIS7 that you should be able to find.

For the CPU usage, there are a few ways you can go about this as well. Depending on if you want total CPU usage, or a per-process CPU usage.

Also, here is a tutorial on reading from the process counter.

like image 59
Mitchel Sellers Avatar answered Sep 18 '22 06:09

Mitchel Sellers