Daily Archives

One Article

Visual Studio Tips

Attach Debugger to Process with simple shortcut

Posted by matteskolin on

When developing an ASP.NE application hosted on IIS, it is frequently necessary to attach visual studio to the IIS worker processes in order to use the debugger.

The usual method is to do the following..

1) Select Debug -> attach to process toopen the attach to process window.

2) Sort the process names backwards to find w3wp.exe worker process

3) click attach (possibly even restarting visual studio as administrator to have the right permissions)

When doing this several times an hour, this 3 stop process is a pain.

Here are 2 ways – a fast way, and a much faster way to make attaching to the IIS worker process much faster.

Fast way) Use the Attach To All The Things extension. This extension can be found in the visual studio marketplace, and will add an “Attach to IIS” option to the Debug menu. This will reduce the process of attaching to only two clicks, but we can do better. See below for the fastest way.

https://marketplace.visualstudio.com/items?itemName=thebread.AttachToAllTheThings&ssr=false#overview
Attach To All The Things – Visual Studio Marketplace


Much Faster Way)

The Attach To All The Things extension adds a new Visual Studio command Tools.AttatchToIIS. This mean it is available for a custom keyboard binding!

I have configured my environment for [Cntrl + alt + i] (I for IIS) Now, I can attach to the worker process with a simple shortcut.