SharePoint Debugging : Determine which worker process to attach while debugging

Most of the times, during SharePoint debugging,we see that while trying to attach to process “w3wp”, many process with same name are listed.

How to determine which process we need to attach to? As the dialog box does not contain Application Pool details. Follow the steps given below to easily identify the correct worker process.

  1. Open the Command Prompt with Administrative Privilege
  2. Change the directory to c:\Windows\System\Inetsrv
  3. run “appcmd list wp“. It would list all the worker processed with ID and application pool information:

apppool

4. Find out process ID associated to the web application pool you want to debug.

5. Go back to Visual Studio “Attach to Process” dialog box and associate to correct process with ID we got in Step # 4.

Happy Debugging!!!!