The specified named connection is either not found in the configuration, not intended to be used wit...

本文解决了一个关于EntityFramework中命名连接无法被CLR在运行时找到的问题。解决方案包括确保连接字符串存在于正确的配置文件中,并且需要复制到启动项目的配置文件中。

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid

要么是没有发现在配置中,指定的命名连接,不打算要用于EntityClient提供程序,或不是有效的

 

解决办法:

I suspect that your issue is coming from the fact that you have more than one project in your solution and the one that contains your entity framework stuff including edmx files is NOT the solutions's startup project. In this case even if the connection string exists in the EF app.config project, still CLR cannot find it at runtime. For example if you have a web site and a EF project in your solution, you need to copy the connection string from the EF project's app.config to your website's web.config. Basically any connection string data should be exist in the config file of the project that the .Net threads initiated from by CLR (i.e. your startup project). If this is not your case, then just open your edmx file, right click on its surface, select properties and copy the connection string and paste it into your app.config Connection String section. This way you can make sure that you are having the correct one in your config. 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值