I'm using miniprofiler in MVC project on App_Start() method I invoke
MiniProfilerEF6.Initialize()
and I get the error :
the Entity Framework was already using a DbConfiguration
instance before an attempt was made to add an 'Loaded' event handler.
'Loaded' event handlers can only be added as part of application start
up before the Entity Framework is used. See http://go.microsoft.com/fwlink/?LinkId=260883 for more information.
If you have any
PreApplicationStartMethod
's any where in the project, then make sure you move yourMiniProfilerEF6.Initialize()
fromGlobal.asax
to that class Start methodIn my case I use static StructuremapMvc class to setup Ioc, and have
so have
this fixed for me.
try to add MiniProfilerEF6.Initialize() in application_start function of your Global.asax and make sure it is the first line there.