.Net Core使用 MiniProfiler 進行性能分析(轉)

轉自:http://www.cnblogs.com/ideacore/p/9505425.htmlhtml

官方文檔: https://miniprofiler.com/dotnet/AspDotNetCoreapp

一、添加包 MiniProfiler.AspNetCore.Mvc   和    MiniProfiler.EntityFrameworkCoreide

二、在 Startup.cs 中的 ConfigureServices 下添加,也能夠根據官方文檔中的說明進行相應的配置佈局

services.AddMiniProfiler().AddEntityFramework();

三、在 Startup.cs 中的 Configure 下添加idea

app.UseMiniProfiler();

四、修改 _ViewImports.cshtml code

@using StackExchange.Profiling
@addTagHelper *, MiniProfiler.AspNetCore.Mvc

五、將MiniProfiler添加到佈局文件(Shared/_Layout.cshtml)中htm

<mini-profiler />

最後查看效果blog

實際使用中能夠考慮判斷當前環境爲開發環境再開啓該功能。ip

相關文章
相關標籤/搜索