24

我一直在使用 MiniProfiler 来测量站点性能。当我从 1.9 版升级到 2.0 版时,它停止了工作。我将命名空间从 MvcMiniProfiler 更改为 StackExchange.Profiling。但是当我加载页面时,提琴手显示以下请求出现 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>

我试图让 MiniProfiler 2.0 与配置文件中包含的那些一起运行,并且将它们排除在外,但这两种方法都不起作用。

这是在我的 IIS Express 开发机器上运行的。

我的应用程序是使用表单安全性的 WebForms 应用程序。

我该如何解决这个问题?

4

5 回答 5

26

It looks like this is a common problem, just add this to the web.config and it should be fine

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>
于 2013-01-15T04:06:48.823 回答
1

我最终要做的是在我的服务器上创建一个名为 mini-profiler-resources 的文件夹,然后将 StackExchange.Profiling/UI 中的所有文件复制到其中。不知道为什么这有效。我猜我缺少一些服务器设置,因为我只需要在生产系统上执行此操作。开箱即用,一切正常,可用于开发。

于 2012-04-29T02:30:22.350 回答
1

for me its start working when I write following code

 protected void Application_EndRequest()
        {
            MiniProfiler.Stop();
        }

instead of

 protected void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown
        MiniProfiler.Stop();
        }
于 2013-09-14T04:59:31.083 回答
0

aspnet_regiis -i尝试通过从 Windows\Microsoft.NET 目录下的相应 .NET Framework 文件夹运行来重新注册 ASP.NET 。我有类似的问题,通过重新注册 ASP.NET 处理程序得到了解决。

我想我在安装 .NET Framework 后在 IIS 中安装静态文件服务功能后遇到了这个问题。

于 2012-04-25T09:12:31.760 回答
0

To Fix this i had to change the DefaultAppPool from Classic to Integrated.

This fixed the issue.

Also since i am using MVC4, i had to download the sources of MiniProfiler and compile them with the MVC4 libraries.

于 2013-09-20T09:59:01.693 回答