本質上,集成Miniprofiler能夠分解爲三個問題:後端
首先安裝Miniprofiler,MiniProfiler.EF6ide
在Global.asax 加入性能
1 protected override void Application_Start(object sender, EventArgs e) 2 { 3 StackExchange.Profiling.EntityFramework6.MiniProfilerEF6.Initialize(); 4 MiniProfiler.Settings.Results_Authorize = p => true; 5 MiniProfiler.Settings.Results_List_Authorize = p => true; 6 MiniProfiler.Settings.RouteBasePath = "~/profiler/";//訪問路徑/profiler/results 或者/profiler/results-index 7 8 base.Application_Start(sender, e); 9 } 10 11 12 protected void Application_BeginRequest() 13 { 14 15 MiniProfiler.Start(); 16 17 } 18 19 protected void Application_EndRequest() 20 { 21 MiniProfiler.Stop(); 22 }
運行項目,http://localhost//profiler/results-index 便可看到監測結果spa