我有问题说
The specified named connection is either not found in the configuration, not intended to be used with the
EntityClient
provider, or not valid.
我的 edmx 文件在单独的项目中,但该项目的 app.config
中有连接字符串
可能导致问题的原因是什么?
最佳答案
确保 app.config 位于设置为启动项目的项目中。
如果我理解正确(我希望我理解正确!):
你有两个项目:
ApplicationServices(启动项目)
- Web.config
实体容器
MyEdmx.edmx
App.config
当项目启动时,它会从 web.config 文件中读取。
您需要确保连接字符串在 web.config 文件中。如果我不打算使用它们,我通常会从其他项目中删除 app.config。
还要仔细检查 ApplicationServices 项目引用 EntityContainer。
关于c# - edmx 文件在单独的项目中时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4952269/