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