Tuesday, July 5, 2016

How to Identify Correct W3WP Process in Visual Studio while debugging

This article taken from here
This article explains about how to identify the correct w3wp process for “Attach to Process” in visual studio while debugging.
In most of the time, being a developer, we will be attaching to the W3WP Process. But when we try to attach the process using the Visual Studio, we will be seeing many w3wp processes running. We will be in a dilemma to which we need to attach and at-last, as usual, we will be attaching to all the w3wp processes.
This happens because, the Attach to Process popup doesn’t show the Application Pool details.
clip_image002
To identify the Process for our Application Pool, Open the command prompt as administrator.
Navigate to the folder C:\Windows\System32\inetsrv\. Enter the command “appcmd.exe list wp”. This will list all the worker process associated with the Application Pools.
clip_image004
We know our Application Pool name. Note down the ID corresponding to the Application Pool.
Now coming back to visual studio and click “Attach to Process”. Attach the process with a specific ID which we noted. That’s it. Now we are done with “Attach to Process”. Happy debugging.