要查看页面耗时,EFCore的性能.
Install-Package MiniProfiler.AspNetCore.Mvc
编辑Startup.cs
public void ConfigureServices(IServiceCollection services) { //EFCore性能监控 services.AddMiniProfiler().AddEntityFramework(); ... }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IMemoryCache cache)
{
app.UseMiniProfiler();
// The call to app.UseMiniProfiler must come before the call to app.UseMvc
app.UseMvc(routes =>
{
// ...
});
}
编辑 _ViewImports.cshtml
:
@using StackExchange.Profiling
@addTagHelper *, MiniProfiler.AspNetCore.Mvc
Add MiniProfiler to your master layout (Shared/_Layout.cshtml
by default):
<mini-profiler />