Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Below is my core macro. Write a few one-line subs calling it, like <code>AttachToW3wp("DefaultAppPool")</code> naming each app pool you’re interested in, and make buttons and hotkeys for them.</p> <pre><code> Private Sub AttachToW3wp(ByVal appPoolName As String) Const processName As String = "w3wp.exe" Dim userName As String = String.Format("IIS APPPOOL\{0}", appPoolName) Try Dim debugger As EnvDTE90.Debugger3 = CType(DTE.Debugger, EnvDTE90.Debugger3) 'debugger.DetachAll() Dim transport As EnvDTE80.Transport = debugger.Transports.Item("Default") Dim qualifier As String = Environment.MachineName '= My.Computer.Name Dim engines(3) As EnvDTE80.Engine engines(0) = transport.Engines.Item("Managed") engines(1) = transport.Engines.Item("Script") engines(2) = transport.Engines.Item("T-SQL") Dim successMessage As String = String.Empty For Each process As EnvDTE80.Process2 In debugger.GetProcesses(transport, qualifier) With process Dim fi As New System.IO.FileInfo(.Name) If fi.Name = processName AndAlso (String.Compare(.UserName, 0, userName, 0, Len(userName), True) = 0) Then If .IsBeingDebugged Then Throw New Exception(String.Format("{0} {1} is already attached to a debugger.", processName, userName)) process.Attach2(engines) successMessage = String.Format("Attached to {0} for {1} ({2})", processName, userName, .ProcessID) Exit For End If End With Next If successMessage = String.Empty Then Throw New Exception(String.Format("{0} {1} not found.", processName, userName)) Else Trace.WriteLine(successMessage) End If Catch ex As System.Exception MsgBox(ex.Message) End Try End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload