MiniProfiler ASP.NET MVC5 无法获得结果

问题描述

我正在尝试将 MiniProfiler 用于 ASP.NET MVC 应用程序。我安装了以下 NuGet 包。我在 Global.ascx 和 _Layout 中的脚本中都配置了 MiniProfiler。但我收到后脚本错误以获得结果。负载没有问题。但是我没有得到结果,浏览器上也没有图标,因为由于 POST 错误没有显示结果。

1- MiniProfiler.MVC5 2- MiniProfiler.EF6

错误

enter image description here

Web.Config

enter image description here

Global.ascx - 应用程序启动:

enter image description here

enter image description here

加载脚本标签

enter image description here

解决方法

在当前的实现中,您将积累永无止境的 MiniProfiler,这可能会导致内存泄漏(如果您正在调查这些症状,我会注意到这一点)。不过,这是一个快速修复!

如果您在此处查看 MiniProfiler MVC5 示例项目:Samples.Mvc5/Global.asax,重要的区别在于分析器停止的位置。最终,您希望 Application_EndRequest(神奇命名)方法停止每个请求的分析器,而不是当前的 Application_End,后者只会关闭当前的分析器(......这可能是 {{1 }}) 当应用程序最终整体结束时。