2012年1月13日金曜日

Registry tweaks for attaching to IIS 7 worker process from Visual Studio 2010

One of the common techniques for debugging ASP.NET applications is to attach the Visual Studio IDE debugger to a running IIS 7 worker process.

I have been doing this for so many years that my fingers, without even thinking, press "Ctrl+Alt+p" to bring up the "Attach to Process" dialog (alternatively, you can get to it by "Debug | Attach to process..." menu item)

With Visual Studio 2010 on Windows 7 (IIS7), when you bring up "Attach to Process", it will look like this by default:


Notice that "Show processes from all users" and "Show processes in all sessions" are not selected. That prevents IIS 7 worker process from showing up in the list. (By the way, my finger also remembers to hit "w" to jump to the parts for processes with their names starting with "w")

When you check both "Show processes from all users" and "Show processes in all sessions", w3wp.exe, our IIS 7 worker process, will show up.


However, it is a pain in the neck to press these two check boxes every time I want to debug.

I looked for configuration settings in "Tools | Options" dialog but could not find any. Then, I looked for Registry entries and I found them.

Here is the steps for making these check boxes permanently "checked".

1. Close all of your running instances of Visual Studio. This is important as in-memory values of a running instance will overwrite any new value in the registry. So, close it.

2. Go to HKCU\Software\Micorosoft\VisualStudio\10.0\Debugger, then look for a value called ShowProcessesFromAllSessions and ShowSystemProcesses

3. Change its value from 0 to 1 for both.

Below is to help you find it visually.


4. Now, start Visual Studio and see the effect. Back to "Ctrl+Alt+p" and then "w" workflow!

Enjoy!

0 件のコメント:

コメントを投稿