You are getting this error because you are running MiniProfiler.Start()
in the wrong place. You need to run MiniProfiler.Start()
as part of Application_BeginRequest
. Move it to this function and it should work.
When you run it as part of Application_Start
it fails, because it is trying to access HttpContext.Current
, which is not accessible in Application_Start
.
In the context of MiniProfiler, Application_Start
is a good place to make any global MiniProfiler.Setting
customizations that you would like to have in place for all requests.