我一直在使用 MiniProfiler 来衡量站点性能。当我从 1.9 版升级到 2.0 版时,它停止工作。我将命名空间从 MvcMiniProfiler 更改为 StackExchange.Profiling。但是当我加载页面时,fiddler 显示以下请求存在 404 错误:
GET/local/mini-profiler-resources/jquery.1.7.1.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA= HTTP/1.1
这可以防止结果在页面中呈现。
要使 MiniProfiler 的 1.9 版本正常工作,我必须在 Web.Config 文件中包含以下条目(如 this post 中所述):
<system.webServer>
<handlers>
<add name="UrlRoutingModule1" path="mini-profiler*.js" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
<add name="UrlRoutingModule2" path="mini-profiler*.css" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
<add name="UrlRoutingModule3" path="mini-profiler*.tmpl" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
我试图让 MiniProfiler 2.0 与配置文件中包含的那些一起运行并排除它们,这两种方法都不起作用。
这是在我的 IIS Express 开发机器上运行的。
我的应用程序是一个使用表单安全性的 WebForms 应用程序。
我该如何解决?
请您参考如下方法:
看起来这是一个常见的问题,只需将其添加到 web.config 中就可以了
Running MiniProfiler with runAllManagedModulesForAllRequests set to false
<system.webServer>
...
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>