MiniProfilerEF6.Initialize()C#错误? [英] error on MiniProfilerEF6.Initialize() c#?

查看:125
本文介绍了MiniProfilerEF6.Initialize()C#错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MVC项目中使用我调用的App_Start()方法上的miniprofiler

I'm using miniprofiler in MVC project on App_Start() method I invoke

  MiniProfilerEF6.Initialize()

我收到错误消息:

     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.

推荐答案

尝试在Global.asax的application_start函数中添加MiniProfilerEF6.Initialize()并确保这是第一行.

try to add MiniProfilerEF6.Initialize() in application_start function of your Global.asax and make sure it is the first line there.

 protected void Application_Start()
            {          
                  StackExchange.Profiling.EntityFramework6.MiniProfilerEF6.Initialize();

    }

这篇关于MiniProfilerEF6.Initialize()C#错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆