I am using MiniProfiler v3.2.0.157 and MiniProfiler.EF6 v3.0.11 with C# for an ASP.NET MVC 4 website. While I can get the profiler to show up on the majority of the pages on the site, it does not show up on the landing page.
I have tried everything suggested here: MiniProfiler not showing up on asp.net MVC and here: Using MiniProfiler with MVC 5 with no success.
Update: I also tried the Donut Caching Technique described here: Donut hole caching - exclude MiniProfiler.RenderIncludes
I have noticed that for the pages that do work, if there is a breakpoint in Application_BeginRequest
right on MiniProfiler.Start()
, MiniProfiler.Current
has a value for on requests for most of our pages, but in the case of a request for our landing page, it is null at this point. There does not appear to be anything special about the Landing page that would cause problems.
The important parts of my code are show below.
Global.asax.cs:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop(discardResults: false);
}
Web.config:
<system.webServer>
<handlers>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
Layout Page:
@using StackExchange.Profiling;
<head>
...
</head>
<body>
...
@MiniProfiler.RenderIncludes()
</body>
Landing Page Controller:
using StackExchange.Profiling;
...
public ActionResult Landing()
{
var profiler = MiniProfiler.Current;
using (profiler.Step("Content Controller Landing"))
{
var user = ...;
return View(...);
}
}