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


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

1、添加包 MiniProfiler.AspNetCore.Mvc   和    MiniProfiler.EntityFrameworkCore

2、在 Startup.cs 中的 ConfigureServices 下添加,也可以根據官方文檔中的說明進行相應的配置

services.AddMiniProfiler().AddEntityFramework();

3、在 Startup.cs 中的 Configure 下添加

app.UseMiniProfiler();

4、修改 _ViewImports.cshtml 

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

5、將MiniProfiler添加到布局文件(Shared/_Layout.cshtml)中

<mini-profiler />

最后查看效果

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM