Monitoring .NET applications with the Windows Performance Monitor
Posted: (EET/GMT+2)
Before cloud dashboards and application telemetry became common, Windows Performance Monitor (PerfMon) was (and still is) a solid, lightweight way to observe .NET application behavior.
PerfMon has been part of Windows since NT 4.0, and the .NET Framework registers its own performance counters automatically when installed. You can use these counters to monitor memory usage, garbage collections, thread counts, and more without writing a line of C# code.
To explore, open Performance Monitor (perfmon.exe) and navigate to "Monitoring Tools"/"Performance Monitor" and click the "+" button (Add Counters).
Under the .NET CLR Memory category, add counters such as:
- # Gen 0 Collections/sec: frequency of garbage collections
- % Time in GC: percentage of time spent in garbage collection
- Large Object Heap size (Bytes): memory allocated for large objects
- # of Pinned Objects: indicators of potential memory fragmentation.
You can also monitor "Process" - "Private Bytes" and "Working Set" to track total memory footprint per process.
For server applications like IIS-hosted ASP.NET applications, choose the correct application pool instance name first. They map to process IDs.
When analyzing issues, save your PerfMon data collector set to a .blg file, then import it into Excel or Power BI for visualization.
Even today, PerfMon remains one of the most transparent ways to understand what's happening inside a running .NET process. No agents, no dependencies, no development cost.