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

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. 
作者:dupeng0811
版权:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接
留言:同时 , 如果文中有什么错误,欢迎指出。以免更多的人被误导。
原文地址:https://www.cnblogs.com/dupeng0811/p/2671162.html