3

I'm trying to plumb MiniProfiler into my ASP.NET Core MVC web app. I'm not using Entity Framework, I'm using Dapper.

Following the sample app, here are my changes:

  1. Added to Startup.cs ConfigureServices

    services.AddMiniProfiler();

  2. Added to Startup.cs Configure

    app.UseMiniProfiler(new MiniProfilerOptions { // Path to use for profiler URLs RouteBasePath = "~/profiler",

     // Control which SQL formatter to use
     SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter(),
    
     // Control storage
     Storage = new MemoryCacheStorage(cache, TimeSpan.FromMinutes(60)),
    
     // To control which requests are profiled, use the Func<HttpRequest, bool> option:
     ShouldProfile = request => true,
    
     // Profiles are stored under a user ID, function to get it:
     //UserIdProvider =  request => MyGetUserIdFunction(request),
    

    });

  3. Configured the tag helper in my _ViewImports as per the sample

  4. Added the tag helper to my _Layout file, just before the close of the body tag:

<mini-profiler position="@RenderPosition.Left" max-traces="5" show-controls="true" start-hidden="false" />
  1. Made sure my controller produces some output for MiniProfiler:

    using (MiniProfiler.Current.Step("Example step")) { ... }

Despite all this, I get nothing. When I view source, I see that the tag helper has not produced any HTML.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Matt Roberts
  • 26,371
  • 31
  • 103
  • 180
  • 2
    For anyone finding this, docs (including getting started) have been set up here: http://miniprofiler.com/dotnet/ – Nick Craver Jun 11 '17 at 21:01

1 Answers1

2

I'd added the tag helper to the wrong layout file.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Matt Roberts
  • 26,371
  • 31
  • 103
  • 180
  • 2
    For others finding this, it'd help to put which layout file you *did* put it in...as you likely won't be the last to do such a thing :) – Nick Craver Mar 18 '18 at 12:58