3

I have read all the posts I can find and looked at a couple tutorials but haven't made it past go.

  1. Installed MiniProfiler MVC and EF6
  2. Added MiniProfilerEF6.Initialize(); to Global.asax Application_Start()
  3. Added MiniProfiler.Start(); to the protected void Application_BeginRequest() method in Global.asax.
  4. Added the following to my _Layout page

    <div class="row">
        @MiniProfiler.RenderIncludes()
    </div>
    
  5. Wrapped the method call I want to profile, thusly:

    var profiler = MiniProfiler.Current;
    using (profiler.Step("Saving changes"))
    {
        eventId = _calendarRepository.AddUpdateCalendarEvent(eventDto);
    }
    
  6. For good measure, though I shouldn't need to, added the MiniProfiler handler to the web.config system.webserver section.

Everything executes fine but MiniProfiler is nowhere to be found. Tried in Chrome and IE, the div I placed @MiniProfiler.RenderIncludes() in is empty when I view the browser source.

I'm trying to profile a dbContext.SaveChanges() call - I need to see the SQL EF is generating.

Thanks

GDB
  • 3,379
  • 2
  • 26
  • 38
  • How did you install MiniProfiler? Did you use the NuGet package? Do you have a MiniProfiler.cs file in the App_Start folder of your web project? – StriplingWarrior May 27 '14 at 22:57
  • Yes, I installed it with NuGet but no, I don't have a MiniProfiler.cs in my App_Start folder folder. – GDB May 28 '14 at 02:52

2 Answers2

1

I don't see any mention in your description of starting MiniProfiler up for individual requests. It would be something like this in Global.asax:

using StackExchange.Profiling;
...    
protected void Application_BeginRequest()
{
    if (Request.IsLocal || someOtherCriteriaForTurningOnMiniProfiler)
    {
        MiniProfiler.Start();
    } 
}

This is necessary in order to run MiniProfiler for any individual request.

Yaakov Ellis
  • 40,752
  • 27
  • 129
  • 174
  • Thanks Yaakov, I've updated my question. Yes, I have the protected void Application_BeginRequest() code in Global.asax – GDB May 29 '14 at 02:44
-1

Here is a related post that might solve your problem. You need to have the handler registered in your web.config file

MiniProfiler cannot find jquery

Community
  • 1
  • 1
Mr. Kraus
  • 7,885
  • 5
  • 28
  • 33