A macro to automatically attach to aspnet_wp.exe

This was on the win-tech-off-topic mailing list:

A macro to automatically attach to aspnet_wp.exe, written by Kevin Dente can save lots of clicking around time:

<quote>

  Sub AttachAspNet()
        Dim process As EnvDTE.Process

        If Not (DTE.Debugger.DebuggedProcesses Is Nothing) Then
            For Each process In DTE.Debugger.DebuggedProcesses
                If (process.Name.IndexOf("aspnet_wp.exe") <> -1) Then
                    Exit Sub
                End If
            Next
        End If

        For Each process In DTE.Debugger.LocalProcesses
            If (process.Name.IndexOf("aspnet_wp.exe") <> -1) Then
                process.Attach()
                Exit Sub
            End If
        Next
    End Sub

Unfortunately, it's not perfect. Process.Attach doesn't let you
specify the program type (CLR, Script, native, etc). I think that it
uses whatever your last selection was in the UI. But don't quote me
on that, it's been a while.

</quote>

Published Monday, September 22, 2003 1:36 AM by RoyOsherove

Comments

Monday, March 01, 2004 3:29 AM by Rooc

# re: A macro to automatically attach to aspnet_wp.exe

Weird but it only works once every session. When I start it a second time it does all the loop stuff but doesn't actually attach to the process

(By the way I'm using it on a windows2003 machine and search for the w3wp.exe process.)

gr Rooc
Monday, November 13, 2006 5:58 PM by Thomas Freudenberg

# Auto-attaching to aspnet_wp.exe

Dennis van der Stelt asked me how to debug CSModules without using the Community Server SDK. Well, first

Sunday, June 24, 2007 10:08 AM by Howard van Rooijen's Blog

# Attach to Web Server Macro for Visual Studio

Last week I was doing a lot of ASP.NET debugging &ndash; tracing through Microsoft AJAX web service calls