4

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

  1. 使用 nuget 安装包
  2. 在 Global.asax.cs 中添加 MiniProfiler 初始化(Begin_request 和 End_request 事件)
  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 和 Intergated Mode(应用程序池)

有什么想法对我有用吗?

4

1 回答 1

8

我(非常!)最近写了一篇关于这个的博客,特别是让 MiniProfiler 在混合 WebForms/MVC 应用程序中工作的过程

根据您概述的已执行的步骤,您似乎丢失了(与我所拥有的相比):

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

也就是说,即使没有该行,我仍然可以看到服务器端计时和 MiniProfiler UI,因此我怀疑您的web.config输入是/不正确的。

检查以确保您已将其放入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条目 which <clear />shandlers之间的文件夹中?
  2. 您的应用程序中是否还有其他内容可以捕获对 MiniProfiler 资源的请求并返回 404?
于 2017-08-16T07:36:13.290 回答