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:
Added to Startup.cs ConfigureServices
services.AddMiniProfiler();
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),
});
Configured the tag helper in my _ViewImports as per the sample
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" />
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.
I'd added the tag helper to the wrong layout file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With