Running MiniProfiler with runAllManagedModulesForAllRequests set to false

半城伤御伤魂 提交于 2019-11-28 16:49:18
David Duffett

I had the same issue - the resources being requested use "static" file extensions (such as .js) and therefore IIS wants to handle them using its static file handler.

Luckily all of the MiniProfiler resources are requested with the path mini-profiler-resources, so you can add the following to your web.config:

<system.webServer>
  ...
  <handlers>
    <add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
  </handlers>
</system.webServer>

The entry above instructs IIS that any request for the mini-profiler-resources path to be routed through ASP.NET.

As David Duffet says in the comments in the accepted answer, you might also need to add the following entry to your web config. This worked for me:

<system.web>
    <httpHandlers>
      <add verb="*" type="System.Web.Routing.UrlRoutingModule" path="mini-profiler-resources/*"/>
    </httpHandlers>
</system.web>

I had a similar issue and what I did to fix it was change the application pool to 'integrated' and then I added this new line below to my web.config and it then worked.

Here is what the complete web.config looks like now for mini-profiler.

<system.webServer>
    <modules runAllManagedModulesForAllRequests="false" />
    <validation validateIntegratedModeConfiguration="false"/> <!-- Here is the new line -->
    <handlers>
      <add name="MiniProfiler" verb="*" type="System.Web.Routing.UrlRoutingModule" path="mini-profiler-resources/*"/>
    </handlers>
  </system.webServer>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!