編輯 得到的答案here使用MiniProfiler與MVC 5
所以我想退房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();
添加這一行jquery的束下面_layout:
@Scripts.Render("~/bundles/jquery")
@StackExchange.Profiling.MiniProfiler.RenderIncludes()
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
然該應用。 什麼都沒有顯示。沒有分析,沒有。
我錯過了什麼?
問候。
太棒了,我沒有意識到自動控制器和視圖分析的可能性 – Squazz