没有可以在应用程序配置文件中找到名为“MyEntities”的连接字符串 [英] No connection string named 'MyEntities' could be found in the application config file
问题描述
我的解决方案分为两个项目;
- 包含我的数据模型(.edmx)文件和一些自定义界面的类库
- 引用的'container'MVC项目上面的类库
我的问题是当我尝试使用'MyEntites' DbContext 时,我得到以下错误:
在
应用程序配置文件中找不到名为MyEntities的连接字符串。
我猜这个问题与连接字符串位于类库的app.config而不是MVC项目有关。
有没有人有任何建议?
尝试复制连接字符串到MVC项目中的.config文件。
I am using entity framework and ASP.NET MVC 4 to build an application
My solution is split into two projects;
- A class library that includes my data model (.edmx) file and a few custom interfaces
- The 'container' MVC project that references the class library above
My problem is that when I attempt to use the 'MyEntites' DbContext I get the the following error:
No connection string named 'MyEntities' could be found in the application config file.
I guess the problem has something to do with the fact that connection string lies within the app.config of the class library rather than the MVC project.
Does anyone have any suggestions?
Try copying the connections string to the .config file in the MVC project.
这篇关于没有可以在应用程序配置文件中找到名为“MyEntities”的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!