Tuesday, 4 October 2011

How to: Macro for attaching to w3wp.exe

Use the macro below to attach your debugging engine in Visual Studio 2008 to the IIS worker process.

(Note: have updated this to dynamically pick up the Machine name from the System.Environment class.)

    Sub AttachToW3p()

            Dim dbg2 As EnvDTE80.Debugger2 = DTE.Debugger
            Dim trans As EnvDTE80.Transport = dbg2.Transports.Item("Default")
            Dim dbgeng(1) As EnvDTE80.Engine
            dbgeng(0) = trans.Engines.Item("Managed")
            Dim proc2 As EnvDTE80.Process2 = dbg2.GetProcesses(trans, System.Environment.MachineName).Item("w3wp.exe")
        Catch ex As System.Exception
        End Try

    End Sub

No comments:

Post a Comment

Android mediaserver process killing battery life

If this happens to you, then do the following Force stop on Settings, Applications, All, Media Storage. Clear Cache and Clear Data, fo...