.net EF监控 MiniProfiler
1.從NuGet上下載所需要的包:MiniProfiler.mvc,MiniProfiler,MiniProfiler.ef
? ??
2.Global.asax 加入
protected void Application_Start()
{
MiniProfiler.Settings.Results_Authorize = Request =>
{
#if DEBUG
return true;
#else
return false;
#endif
};
StackExchange.Profiling.EntityFramework6.MiniProfilerEF6.Initialize();
}
protected void Application_BeginRequest()
{
if (Request.IsLocal)//這里是允許本地訪問啟動監控,可不寫
· {
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
3.在模板頁中修改
<head>
@using StackExchange.Profiling;
</head>
<body>
@RenderBody()
@MiniProfiler.RenderIncludes()
</body>
?
4. web.config 加入?system.webServer節點
<system.webServer>
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
?
轉載于:https://www.cnblogs.com/zhuzy/p/8991313.html
總結
以上是生活随笔為你收集整理的.net EF监控 MiniProfiler的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: (三)Redis for StackEx
- 下一篇: FZU-2218 Simple Stri