当我尝试使用Entity框架模板添加一个控制器时,我收到一条消息错误,但是我收到一条错误消息 unable to retrieve metadata for 'path' unrecognized element providers. (C:\Users\user\appdata\local\Temp-mp6124.t
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>
我能够通过删除< providers>来解决这个问题。部分配置文件。
这个:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
成为这样
<entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> </entityFramework>
我今天早上有这个问题,刚刚找到了修复。如果您没有指定数据库(和我提供的提供程序),EF将默认为SQL Server Express。
