.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