views:

279

answers:

1

I used a handy macro with keybindings in Visual Studio to attach to Windows XP IIS 5.1:

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Imports System.IO

Public Module AttachDebugger

    ' This subroutine attaches to the first IIS Web Server found.
    Public Sub AttachToFirstIISWebServer()
        Dim process As EnvDTE.Process

        For Each process In DTE.Debugger.LocalProcesses
            If (Path.GetFileName(process.Name).ToLower() = "aspnet_wp.exe") Then
                process.Attach()
                Exit Sub
            End If
        Next

        MsgBox("No IIS Server found")
    End Sub

End Module

However, with Vista, IIS7 process (w3wp.exe) is not anymore in LocalProcesses, but runs as a service on Windows. How can I attach to a service with a macro?

I work often with quite large solutions and don't want to use F5 to recompile everything every time.


RESOLVED: The macro works ok, I just had a wrong process name first. aspnet_wp.exe with XP, w3wp.exe with Vista.

+1  A: 

It may not be running yet. You need to hit the site first to cause IIS to spin it up. Also there may be more than one w3wp.exe (I could be wrong I only know IIS7 from server 2008) if the Vista implementation of IIS7 supports multiple Application pools.

I don't see any reason why when the process is up and running it would not be listed in the local processes set.

AnthonyWJones