1

This is a two part question, which circles around the same problematcis.

Without setting anything up in Global.Asax, and just inserting this line in my .cshtml file for my basic layout, and running my site in debug mode, the MiniProfiler is automatically displayed in my frontend.

@MiniProfiler.RenderIncludes()

Trying to shut down the MiniProfiler doesn't seem to work. I have tried something as obvious as the following code, but the MiniProfiler is still run, and is still represented in my frontend, when running my site locally:

protected void Application_BeginRequest()
{
    MiniProfiler.Stop();
    if (!Request.IsLocal)
    {
        MiniProfiler.Start();
    }
}

Furthermore In Umbraco.Core's WebProfiler I found the following code:

if (GlobalSettings.DebugMode == false) 
    return false;

In my case, i would like to be able to let the Profiler run on my clients site, but that's not possible as DebugMode is always false when I publish my code to my clients site.

Ideally I would like to do something like:

protected void Application_BeginRequest()
{
    MiniProfiler.Stop();
    if (Request.IsLocal || Request.UserHostAddress == "My/developers IP")
    {
        MiniProfiler.Start();
    }
}

How can I programmatically stop the MiniProfiler to set up cases where I don't want it to run when in DebugMode? And how can I make the MiniProfiler available for developers on my customers live sites?

Squazz
  • 3,912
  • 7
  • 38
  • 62
  • What is the purpose of calling `MiniProfiler.Stop()` on the begin of request? It is usually called on request end. – Sergey Fadeev Apr 12 '16 at 20:57
  • For some reason, it's automatically started by Umbraco. Calling MiniProfiler.Stop() in the beginning of the request is an attempt on stopping this behavior (that didn't work) – Squazz Apr 12 '16 at 21:50
  • It seems like a bad decision to tie mini profiler in, and then have the only way to disable it be turning off the ability to debug it. I'm having an error right now that mini profiler is hiding, e.g., it bubbles up to mini profiler and the stack trace looks like mini profiler is the problem. We get an error every time the site is restarted; subsequent refreshes work. – ps2goat May 19 '17 at 21:04

0 Answers0