我一直在使用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
这可以防止在页面中呈现结果.
要获得1.9版本MiniProfiler的工作,我不得不在web.config文件中的以下条目(如在描述这个职位):
<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>
Run Code Online (Sandbox Code Playgroud)
我试图让MiniProfiler 2.0与配置文件中包含的那些一起运行并排除它们,但两种方式都没有用.
这是在IIS Express中的我的开发机器上运行的.
我的应用程序是一个使用Forms安全性的WebForms应用程序.
我该如何解决这个问题?
我厌倦了安装MiniProfiler,使用http://miniprofiler.com/上的HowTo
这似乎有效:
<%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %>
Run Code Online (Sandbox Code Playgroud)
但是,当我启动该网站时,我收到此错误消息:
'MiniProfiler' is undefined
Run Code Online (Sandbox Code Playgroud)
问题在于包含的MiniProfiler代码:
var initMp = function(){
load('/mini-profiler-resources/includes.js?v=6cJT7lsVkH6SxAlFpQstk1/AgtUwMUApXN3pviVvaRE=',function(){
MiniProfiler.init({.....
Run Code Online (Sandbox Code Playgroud)
当我尝试http://localhost/mini-profiler-resources/includes.js?v=6cJT7lsVkH6SxAlFpQstk1/AgtUwMUApXN3pviVvaRE=用IE 打开时,我得到了404.
我甚至试过在stackoverflow上找到这个解决方案,但它对我不起作用:(
有人知道这个问题,或者知道我能做些什么来解决这个问题?
我通过添加此解决方案的" 配置"部分和"runAllManagedModulesForAllRequests"行解决了该问题:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<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>
Run Code Online (Sandbox Code Playgroud)
"技巧"是添加下面的行以使处理程序工作.
<modules runAllManagedModulesForAllRequests="true"/>
Run Code Online (Sandbox Code Playgroud)