我一直在使用MiniProfiler来测量站点性能。当我从1.9版本升级到2.0版本时,它停止了工作。我将名称空间从MvcMiniProfiler更改为StackExchange.Profiling。但是当我加载一个页面时,fiddler显示以下请求有一个404错误:
获取/local/mini-profiler-resources/jquery.1.7.1.js?v=tNlJPuyuHLy/d5LQjyDuRbWKa0weCpmO3xkO6MH4TtA= HTTP/1.1
这会阻止在页面中呈现结果。
要使1.9版本的MiniProfiler工作,我必须在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应用程序。
我该如何解决这个问题?
发布于 2013-01-15 12:06:49
看起来这是一个常见的问题,只需将此代码添加到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>发布于 2012-04-29 10:30:22
我最终要做的是在我的服务器上创建一个名为mini-profiler-resources的文件夹,然后将StackExchange.Profiling/UI中的所有文件复制到其中。不过,我不确定为什么会这样。我猜我遗漏了一些服务器设置,因为我只需要在生产系统上执行此操作。对于开发来说,一切都开箱即用。
发布于 2013-09-14 12:59:31
对我来说,当我写下下面的代码时,它就开始工作了
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}而不是
protected void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
MiniProfiler.Stop();
}https://stackoverflow.com/questions/10212725
复制相似问题