title: debugging a HTTP Handler
body: <p>I am using IIS 6 on 2003. I have created a HTTP handler dll that inherits from IHttpAsyncHandler. The dll builds into the inetpub\www8080root\common\bin directory. It is meant to intercept all requests.</p>
  
  <p>The web site is set to monitor port 8080. I have created a common folder in the www8080root directory and have created a virtual directory in II6 to point to it.
  I created a web.config file in the common directory</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
  &lt;system.web&gt;
      &lt;compilation debug="true" defaultLanguage="c#" /&gt;
      &lt;httpHandlers&gt;
          &lt;add verb="*" path="*"
              type="x2Handler.x2Handler, x2Handler" /&gt;
      &lt;/httpHandlers&gt;
  &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>When I access <a href="http://localhost:8080/common/index.html" rel="nofollow noreferrer">http://localhost:8080/common/index.html</a> the HTTP handler causes a crash of w3wp.exe, when I look in the event logs I can see the error within the handler that caused the crash. When I set a breakpoint within VS 2005 the code it doesn't get hit.</p>
  
  <p>In order to debug I need to somehow attach to the process when it is running under IIS but as soon as it processes a request, it crashes. </p>
  
  <p>How do I debug a HTTP Handler dll under IIS? I can't see a aspnet_wp.exe process to attach to as described here: <a href="https://stackoverflow.com/questions/1070305/c-debugging-an-httphandler">C#, Debugging an HTTPHandler</a></p>
  
  <p>EDIT:
  By adding Debugger.Break() I now receive the message "w3wp.exe has triggered a breakpoint" and it allows me to select a debug environment, but it loads without symbols</p>
  
  <pre><code>No symbols are loaded for any call stack frame. The source code cannot be displayed.
  </code></pre>
  
  <p>I set Tools->Options->Debugging->Enable Just My Code
  I set the path to the common/bin location to load symbols from. Any manually set breakpoints still display:</p>
  
  <pre><code>The breakpoint will not currently be hit. No symbols have been loaded for this document.
  </code></pre>
  
  <p>EDIT:
  When it loads it appears to be looking for the symbols of ntdll.pdb. Even if I manually load the symbol file for the httpHandler it makes no difference.<br>
  The code is definitely executing though.</p>