Entity framework 无法检索无法识别的元素提供程序的元数据
每当我尝试使用实体框架模板添加控制器时,都会收到一条错误消息,但我总是收到一条错误消息Entity framework 无法检索无法识别的元素提供程序的元数据,entity-framework,asp.net-mvc-4,ef-code-first,database-connection,connection-string,Entity Framework,Asp.net Mvc 4,Ef Code First,Database Connection,Connection String,每当我尝试使用实体框架模板添加控制器时,都会收到一条错误消息,但我总是收到一条错误消息 unable to retrieve metadata for 'path' unrecognized element providers. (C:\Users\user\appdata\local\Temp-mp6124.tmp line 78) 我知道这和连接字符串有关,所以这里是我的连接字符串 <connectionStrings> <add
unable to retrieve metadata for 'path' unrecognized element providers.
(C:\Users\user\appdata\local\Temp-mp6124.tmp line 78)
我知道这和连接字符串有关,所以这里是我的连接字符串
<connectionStrings>
<add name="NoktatyContext" connectionString="Data Source=(localdb)\v11.0; Initial Catalog=NoktatyContext-20140122154208; Integrated Security=True; MultipleActiveResultSets=True; AttachDbFilename=|DataDirectory|NoktatyContext-20140122154208.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
我可以通过删除配置文件的
部分来解决此问题
这:
变成这样:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
我今天早上遇到了这个问题,刚刚找到了解决办法。如果不指定数据库(我想还有提供程序),EF将默认为SQL Server Express。MVC scaffolding不支持Entity Framework 6或更高版本 请安装当前版本的Entity Framework,vs安装包EntityFramework-版本5.0.0 删除标签 重新启动VS
好的你的web.config或app.config的
部分看起来像什么?真棒!我只是想补充一点,对于那些关注w3schools上ASP.NET MVC教程的人来说,这是我的解决方案。原因是如果您启动一个以.NET 4.5为目标的项目,然后在引用的程序集中使用EntityFramework版本,而该程序集不需要该元素。例如,v5之前的EF版本(或.Net 4.0的EFv5本身,实际上是EFv4.4)。在我的示例中,我的app.config中有重复的提供程序和多个entityFramework标记。我将它们组合在一个entityFramework标记下,这解决了我的问题。这不再是事实
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>