title: Duplicated requests when debugging ASP.NET on IIS Express
body: <p>I noticed a strange behavior while debugging an ASP.NET Web Application (.NET 4.6.1). Whenever an HTTP error occurs (e.g. 404 or 403) the request get duplicated up to a total of 3 times.</p>
  
  <p>I have tested this singular issue using fiddler, and Intellitrace effectively shows me the three identical requests (even if I send just a single request).</p>
  
  <p><a href="https://i.stack.imgur.com/TSy7t.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TSy7t.png" alt="Fiddler"></a>
  <a href="https://i.stack.imgur.com/lpXZ5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lpXZ5.png" alt="Intellitrace"></a></p>
  
  <p>I can see the effects of this issue because any Owin middleware in the pipeline is invoked three times. A simple middleware like this:</p>
  
  <pre><code>app.Use(async (c, n) =&gt;
  {
      Debug.WriteLine("HIT!");
      await n.Invoke();
  });
  </code></pre>
  
  <p>Will print three consecutive "HIT!" into the console.</p>
  
  <p>This happens only if the request generates an error, and not if the request is handled by a middleware (e.g. not if the middleware responds with a 2XX status code).</p>
  
  <p>What's going on?</p>
  
  <p>I'm running VS2015 and IIS Express 10 on Win10.</p>
  
  <p>[EDIT] It may be related to my Web.config configuration? I'm adding an excerpt from it.</p>
  
  <pre><code>&lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.6.1" /&gt;
      &lt;httpRuntime targetFramework="4.6.1" enableVersionHeader="false" /&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
      &lt;httpProtocol&gt;
          &lt;customHeaders&gt;
              &lt;clear /&gt;
          &lt;/customHeaders&gt;
          &lt;redirectHeaders&gt;
              &lt;clear /&gt;
          &lt;/redirectHeaders&gt;
      &lt;/httpProtocol&gt;
      &lt;security&gt;
          &lt;requestFiltering removeServerHeader="true" /&gt;
      &lt;/security&gt;
      &lt;handlers&gt;
          &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt;
          &lt;remove name="OPTIONSVerbHandler" /&gt;
          &lt;remove name="TRACEVerbHandler" /&gt;
          &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt;
      &lt;/handlers&gt;
      &lt;modules runAllManagedModulesForAllRequests="true" /&gt;
  &lt;/system.webServer&gt;
  </code></pre>