Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Two common reasons for breakpoints not being hit in an HttpModule are:</p> <h3>The breakpoint is in code that is called during the module's construction.</h3> <p>This one always get's me. If you want to debug the module's construction <strong><em>you should manually attach the debugger</em></strong>. To do this on Windows 7 (it'll be similar on Vista):</p> <ol> <li><em>Debug | Attach to Process...</em></li> <li>Check <em>Show processes in all sessions</em>.</li> <li>Select the your worker process instance (<em>w3wp.exe</em>)</li> <li>Click <em>Attach</em>.</li> </ol> <p>Refresh your browser and you should now hit your breakpoint.</p> <h3>The module is not actually being loaded because of a configuration issue.</h3> <p>If you can tell that the module code is <em>definitely</em> being executed then this is not the problem. But sometimes, while a module is loading fine on other machines it might not be loading on your dev box because you have a different version of IIS and you don't have the necessary config.</p> <p>If this is the the case then make sure the module is wired up correctly for all required versions of IIS.</p> <p>For IIS 5.1 and IIS 6...</p> <pre><code>&lt;system.web&gt; &lt;httpModules&gt; &lt;add name="CustomHttpModule" type="MyCustomHttpModule"/&gt; &lt;/httpModules&gt; &lt;/system.web&gt; </code></pre> <p>...and for IIS 7+</p> <pre><code>&lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"&gt; &lt;add name="CustomHttpModule" type="MyCustomHttpModule"/&gt; &lt;/modules&gt; &lt;/system.webServer&gt; </code></pre>
 

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