I noticed strange behavior when debugging an ASP.NET web application (.NET 4.6.1). Whenever an HTTP error occurs (for example, 404 or 403), the request is duplicated up to 3 times.
I tested this single problem using a script, and Intellitrace effectively shows me three identical requests (even if I send only one request).

I see the effects of this problem because any Owin middleware in the pipeline gets called three times. Simple middleware like this:
app.Use(async (c, n) => { Debug.WriteLine("HIT!"); await n.Invoke(); });
Will print three consecutive "HIT!" to the console.
This only happens if the request generates an error, and not if the request is processed by middleware (for example, if the middleware does not respond with a 2XX status code).
What's happening?
I am running VS2015 and IIS Express 10 on Win10.
[EDIT] Perhaps this is due to my Web.config configuration? I am adding a passage from it.
<system.web> <compilation debug="true" targetFramework="4.6.1" /> <httpRuntime targetFramework="4.6.1" enableVersionHeader="false" /> </system.web> <system.webServer> <httpProtocol> <customHeaders> <clear /> </customHeaders> <redirectHeaders> <clear /> </redirectHeaders> </httpProtocol> <security> <requestFiltering removeServerHeader="true" /> </security> <handlers> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="OPTIONSVerbHandler" /> <remove name="TRACEVerbHandler" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer>
source share