迷你分析器不显示任何关于 sql 查询的统计信息
我根据文档和应用程序示例进行设置: https ://miniprofiler.com/dotnet/HowTo/ProfileEFCore https://github.com/MiniProfiler/dotnet/blob/main/samples/Samples.AspNetCore3/Startup 。CS
这是我的 Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<MyDbContext>(options => options.UseNpgsql ("connstring..."));
services.AddMiniProfiler()
.AddEntityFramework();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseMiniProfiler();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
...
});
}
以及调用 sql 查询的示例
await using (var context = scope.ServiceProvider.GetRequiredService<MyDbContext>())
{
var myDatas = context.Datas.AsNoTracking()
.Where(x => x.StartTime > now );
foreach (var myData in myDatas)
{
...
}
执行此请求后,我使用迷你分析器统计信息检查页面:
https://localhost:port/mini-profiler-resources/results-index
https://localhost:port/mini-profiler-resources/results?id=GUID
并且只看到这个:
| | duration (ms)| with children (ms) | from start (ms)
| https://localhost:port/logins/| 231.9 | 236.5 | +0.0
| MiniProfiler Init | 4.5 | 4.6 | +0.0
| Get Profiler IDs | 0.1 | 0.1 | +4.5
我错过了什么 ?为什么我看不到 SQL 查询的统计信息?