1

I'm writing a program to monitor web application performance, mostly CPU use and break down per application pool / site.

Using Microsoft.Web.Administration I've been able to get a list of application pools, the worker processes, the process IDs and processes with a performance counter to measure those.

However, the IIS w3wp.exe processes created by the app pools aren't the actual executing code when using .NET Core and kestrel as the actual web server.

Obviously, I could hard code / config file a bunch of process names and setup a performance monitor on those however a) this doesn't allow for any dynamic updates and b) doesn't tie back to a specific site or app pool.

I've been unable to find the link between the IIS site and the Kestrel server running for that site - I can get the web.config and then the process path from there, which will but only if the apps have the different names, as we can't get a process ID from this?

Is there a Microsoft.Web.Administration type system for Kestrel?

RemarkLima
  • 11,639
  • 7
  • 37
  • 56
  • You need to find child processes. So if you have the process ID for w3wp.exe then the children are the processes with a PPID (parent process id) that matches the PID of w3wp.exe. There also may be other descendants. – jdweng Jun 23 '20 at 11:47
  • Ah, so I need to get all the processes, then find those with the parent ID - I was looking for Children! – RemarkLima Jun 23 '20 at 12:14
  • Windows doesn't make it easy. – jdweng Jun 23 '20 at 12:19
  • Indeed! However, from the `System.Diagnostics.Process` class there's no PPID or Parent anything... Would they have the same session ID?? – RemarkLima Jun 23 '20 at 12:22
  • See : https://stackoverflow.com/questions/14020430/how-to-get-ppid – jdweng Jun 23 '20 at 12:26
  • @jdweng That's awesome - add an answer and some upvotes are coming your way! Windows only but it's IIS so must be Windows only ;) – RemarkLima Jun 23 '20 at 12:39

0 Answers0