【发布时间】:2014-03-29 05:45:18
【问题描述】:
编辑 得到答案here
所以我想查看 MiniProfiler 来解决一些性能问题。 在将它用于生产代码之前,我想通过示例进行尝试,因此继续创建 MVC 5 应用程序。这是使用模板创建的普通应用程序。
在 HomeController 的 Index() 方法中添加了这段代码:
var profiler = MiniProfiler.Current;
using (profiler.Step("Set page title"))
{
ViewBag.Title = "Home Page";
}
using (profiler.Step("Doing complex stuff"))
{
using (profiler.Step("Step A"))
{ // something more interesting here
Thread.Sleep(100);
}
using (profiler.Step("Step B"))
{ // and here
Thread.Sleep(250);
}
}
return View();
在 _Layout 中的 jquery 包下面添加了这一行:
@Scripts.Render("~/bundles/jquery")
@StackExchange.Profiling.MiniProfiler.RenderIncludes()
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
运行应用程序。 什么都没有出现。没有分析,什么都没有。
我错过了什么?
问候。
【问题讨论】:
标签: asp.net-mvc mvc-mini-profiler