Quantcast
Channel: General
Viewing all articles
Browse latest Browse all 7363

Finding App Pool Memory Usage

$
0
0

I need to figure out an way to display the memory used by each application pool in the current machine - IIS in C# code. I am able to figure out the state of an app pool using the following code.

                string appPoolPath = @"IIS://" + currentserverName + "/W3SVC/AppPools/" + appPoolName;
int intStatus = 0;
try { DirectoryEntry w3svc = new DirectoryEntry(appPoolPath); intStatus = (int)w3svc.InvokeGet("AppPoolState"); switch (intStatus) { case 2: status = "Running"; break; case 4: status = "Stopped"; break; default: status = "Unknown-" + intStatus.ToString(); break; } } catch (Exception ex) { throw ex; }

But I also need the CPU Usage so that this can be a tool to assess the status of the applications pools.


Viewing all articles
Browse latest Browse all 7363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>