Jul 16 2010

Debug IIS Macro for Visual Studio

Published by at 7:03 pm under General

This is a little macro that you can use in Visual Studio to make it easy to attach to the w3wp processes that are spawned by IIS:

Public Sub AttachToWebServer()
   Dim process As EnvDTE.Process
   For Each process In DTE.Debugger.LocalProcesses
       System.Diagnostics.Debug.Print(process.Name)
       If (Path.GetFileName(process.Name).ToLower() = "w3wp.exe") Then
           process.Attach()
       End If
   Next
End Sub

I should point out that in Windows 7 and Windows Server 2008 you will need to run Visual Studio as Administrator, or disable UAC.

One response so far

One Response to “Debug IIS Macro for Visual Studio”

  1. Sion 11 Nov 2010 at 10:55 am

    Thanks just wat I googled for “debug iis macro” top hit.

Trackback URI | Comments RSS |

Leave a Reply