Using MiniProfiler with the ABP Framework

MiniProfiler is a library and UI for profiling your application. By letting you see where your time is spent, which queries are run, and any other custom timings you want to add, MiniProfiler helps you debug issues and optimize performance.

The Source Code

You can get the source code in this article at

Getting Started

1- Creating ABP Application

 abp new Profiler -t app

2- Add MiniProfiler packages to the Profiler.Web project.

<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.2.22" />
<PackageReference Include="MiniProfiler.EntityFrameworkCore" Version="4.2.22" />

3- Configure MiniProfiler

  1. Configure MiniProfiler in ConfigureServices method of ProfilerWebModule.
public override void ConfigureServices(ServiceConfigurationContext context)
    var hostingEnvironment = context.Services.GetHostingEnvironment();
    var configuration = context.Services.GetConfiguration();


private void ConfigureMiniProfiler(ServiceConfigurationContext context)
    context.Services.AddMiniProfiler(options =>
        //More options see
  1. Add MiniProfilerViewComponent(Profiler.Web\Components\MiniProfiler\MiniProfilerViewComponent.cs)
public class MiniProfilerViewComponent : AbpViewComponent
    public virtual IViewComponentResult Invoke()
        return View("~/Components/MiniProfiler/Default.cshtml");


<mini-profiler />


@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bootstrap
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling
@using StackExchange.Profiling
@addTagHelper *, MiniProfiler.AspNetCore.Mvc
  1. Add MiniProfilerViewComponent to Layout.
context.Services.Configure<AbpLayoutHookOptions>(options =>
    options.Add(LayoutHooks.Body.Last, typeof(MiniProfilerViewComponent));
  1. Add UseMiniProfiler to the ASP.NET Core pipeline.
public override void OnApplicationInitialization(ApplicationInitializationContext context)
    var app = context.GetApplicationBuilder();
    var env = context.GetEnvironment();

    //...Other middlerware



4- Migrate and run the Project

Run the Profiler.DbMigrator and then run the Profiler.Web project and see the result.

ElifKaya 53 weeks ago

It is a really good example, but it is insufficient to see all API calls' SQL queries on the "tiered" application projects.

maliming 53 weeks ago

This is more related to MiniProfiler, we have done everything we can.