与runAllManagedModulesForAllRequests运行MiniProfiler设

2019-06-23 22:40发布

Recently we upgraded to MiniProfiler version 2.0.1 from v1.7, and since then we have not been able to use it in our MVC3 website because when it tries to get its resources, it instead gets a 404.

An example resource call is: /mini-profiler-resources/includes.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA=

In searching around, most people are suggesting that simply setting runAllManagedModulesForAllRequests should be set to true. For giggles, I went ahead and set it to true, and yes it did work. But that is not an acceptable answer.

How can I keep runAllManagedModulesForAllRequests=false and still use MiniProfiler v2?

Answer 1:

我有同样的问题-所请求的资源使用“静态”的文件扩展名(如.js ),因此IIS希望使用其静态文件处理程序来处理它们。

幸运的是,所有的MiniProfiler资源的请求与路径mini-profiler-resources ,这样你就可以添加以下到您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>

上述指示进入IIS,对于任何要求mini-profiler-resources路径通过ASP.NET路由。



Answer 2:

正如David Duffet在接受答案的评论说,你可能还需要将以下条目添加到您的网络配置。 这为我工作:

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


Answer 3:

我也有类似的问题,我做了什么来解决它是改变应用程序池“综合”,然后我说低于这个新的生产线,以我的web.config,它然后工作了。

下面是完整的web.config看起来像现在小探查什么。

<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>


文章来源: Running MiniProfiler with runAllManagedModulesForAllRequests set to false