Error when edmx file is in a separate project

情到浓时终转凉″ 提交于 2019-12-22 13:36:06

问题


I have problem that says

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

My edmx file is in separate project, but that project has connection string in its app.config

What could cause the problem?


回答1:


Make sure the app.config is in the project which is set to be the startup project.

IF I understand correctly (I hope I do!):

You have two projects:

ApplicationServices (Startup Project)

  • Web.config

EntityContainer

  • MyEdmx.edmx

  • App.config

When the project starts up, it reads from the web.config file.

You need to make sure the connection string is in the web.config file. I usually remove the app.config from the other projects if I do not plan on using them.

Also double check ApplicationServices project references EntityContainer.



来源:https://stackoverflow.com/questions/4952269/error-when-edmx-file-is-in-a-separate-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!