EFProfiler
1.0.0
實體框架profiler(efprofiler)是查找慢速查詢的工具
pm> Install-Package EFProfiler
您還可以在Nuget上查看包裝頁面。
您應該在appsetting.js文件中添加此配置:
"EFProfilerSetting": {
"MaxMillisecond": 100,
"Path": "wwwroot\LogFile\",
"ActiveLog": true,
"EFProfilerUIOptions": {
"RoutePrefix": "efprofiler",
"DocumentTitle": "EFProfiler UI",
"HeadContent": "EFProfiler",
"Authorization": {
"Roles": "admin",
"Users": ""
}
}
}
添加所需的服務啟動類如下:
services.AddDbContext(options =>
{
options.UseSqlServer(_configuration.GetConnectionString("DataContext"));
options.AddInterceptors(_configuration);
});
顯示日誌:
app.EFProfilerUI(_configuration);
配置儀表板授權:
app.UseAuthentication();
app.UseAuthorization();
app.EFProfilerUI(_configuration);
然後在瀏覽器中輸入以下地址:
https://{sitename}/efprofiler/index.html