When you need to debug .Net application, normally you need to attach to the w3wp.exe process.
For example:
However, sometimes you don’t want to attach all the worker process but only like to focus the particular one, then you need to find the process id, I used to use Process Explorer tool:
This method works good except it’s a little bit overkill to just find the process id, after a little digging, I found this useful command appcmd.exe provided by Microsoft:
%systemroot%\system32\inetsrv\APPCMD list wp WP "23452" (applicationPool:MyAppPool) WP "13076" (applicationPool:MyWebApplication) WP "29588" (applicationPool:MyWebApi) WP "28932" (applicationPool:MyWebService) WP "25036" (applicationPool:MyRESTAPI)