随笔 - 290  文章 - 10  评论 - 84  2

要查看页面耗时,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 />

 

posted on 2019-02-22 18:43  Gu  阅读(...)  评论(... 编辑 收藏