Post

Monitoring Exceptions in .NET/IIS Processes with ProcDump

In production environments, monitoring for exceptions is critical to maintaining the health and performance of your .NET or IIS applications. One of the best tools for capturing these exceptions is ProcDump—a simple yet powerful utility from Sysinternals.

In this post, I’ll walk you through how to use ProcDump to monitor .NET or IIS processes for exceptions, helping you diagnose those elusive crashes or performance bottlenecks.


Why Use ProcDump?

When your application runs into unexpected issues, getting insight into what caused the exception can be difficult without the right tools. ProcDump allows you to capture a memory dump when certain conditions, like unhandled exceptions, occur in your process. This dump can then be analyzed using debuggers like WinDbg to pinpoint the problem.


Setting Up ProcDump

Step 1: Download ProcDump

You can download ProcDump from the official Sysinternals website.

After downloading, extract the files to a location on your server or development machine.

Step 2: Identify the Process to Monitor

If you’re running an IIS application, you’ll need the Process ID (PID) of the IIS worker process, w3wp.exe or any other .NET.

Here’s how you can get it:

  • Open Task Manager → Go to the Details tab
  • Look for your process name e.g. w3wp.exe and note down its PID

Using ProcDump to Monitor Exceptions

Once you have the PID, you can use ProcDump to monitor the process. Here’s a command that captures a dump when an unhandled exception occurs:

1
procdump -e 1 -ma <PID>
  • -e 1: Instructs ProcDump to capture a dump on the first chance (unhandled) exception.
  • -ma: This flag tells ProcDump to create a full dump that includes all memory in use by the process.

Replace <PID> with the actual Process ID of your application.

Example:

1
procdump -e 1 -ma 1234

Wrapping Up

ProcDump is an incredibly useful tool for diagnosing unhandled exceptions in .NET and IIS applications. By proactively monitoring your processes and analyzing dumps, you can quickly pinpoint the root cause of critical failures in your application.

If you’re dealing with intermittent issues or crashes in production, using ProcDump to monitor your .NET or IIS processes is a great first step in resolving them.

Let me know in the comments how ProcDump has helped you troubleshoot issues!

Happy debugging!

This post is licensed under CC BY 4.0 by the author.