MiniProfiler 和 WebForms

MiniProfiler and WebForms

所以我正在尝试为 WebForms 网站使用 MiniProfiler (https://github.com/MiniProfiler/dotnet)。我所做的是:

  1. 使用 nuget 安装包
  2. 在 Global.asax.cs(Begin_request 和 End_request 事件)中添加 MiniProfiler 初始化
  3. 添加 <%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %> 语句

  4. 设为web.comfig

MiniProfiler 仍然无法正常工作。简单的故障排除表明(在 Chrome 开发工具中)在那个页面上我希望看​​到 MiniProfiler,我看到

http://localhost/mycoolsite/mini-profiler-resources/results 404.0 - 未找到

更多信息:我使用 .Net FW 4.5.1、IIS8 和集成模式(应用程序池)

任何可能对我有用的想法?

我最近(非常!)在博客上讨论了这个问题,特别是 the process of getting MiniProfiler working in a hybrid WebForms/MVC application

根据您概述并执行的步骤,您似乎遗漏了(与我得到的相比):

<%= StackExchange.Profiling.ClientTimingHelper.InitScript %>

就是说,即使没有那条线,我仍然看到 服务器端 计时和 MiniProfiler UI 所以我怀疑你的 web.config 条目 was/is 不正确。

检查以确保您已将其放入 configuration > system.webServer > handlersweb.config:

<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />

您还可以检查其他几项内容:

  1. 您正在查看的页面是否存在于包含 web.config 的子文件夹中,或者存在于它与您添加 handlers 条目的文件夹之间的文件夹中<clear />s handlers?
  2. 您的应用程序中是否还有其他任何东西可以捕获对 MiniProfiler 资源的请求并返回 404?