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.
我怀疑你的问题:你有一个以上的项目在您的解决方案和一个包含你的实体框架的东西包括edmx文件但不是解决方案的启动项目。在这种情况下即使连接字符串存在于EF app.config项目,仍然CLR在运行时无法找到它。例如,如果你有一个网站和一个英孚项目在您的解决方案,您需要复制连接字符串从EF 项目的app.config网站的web . config。基本上任何连接字符串数据应该存在于配置文件的项目。线程启动从CLR(即你的创业计划)。如果这不是你的情况,那就打开你edmx文件,右键单击,选择属性和连接字符串复制并粘贴到您的app.config连接字符串部分。这样就可以确保你有正确的配置。

浙公网安备 33010602011771号