Moh*_*uib 19 entity-framework connection-string database-connection ef-code-first asp.net-mvc-4
每当我尝试添加带有Entity框架模板的控制器时,我都会收到一条消息错误,但我一直收到错误消息
unable to retrieve metadata for 'path' unrecognized element providers.
(C:\Users\user\appdata\local\Temp-mp6124.tmp line 78)
Run Code Online (Sandbox Code Playgroud)
我知道它与连接字符串有关,所以这是我的连接字符串
<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>
Run Code Online (Sandbox Code Playgroud)
mac*_*s01 43
我能够通过删除<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>
Run Code Online (Sandbox Code Playgroud)
变成这样:
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
Run Code Online (Sandbox Code Playgroud)
今天早上我遇到了这个问题,刚刚找到修复程序.如果您没有指定数据库(我猜是提供者),EF将默认为SQL Server Express.
| 归档时间: |
|
| 查看次数: |
18689 次 |
| 最近记录: |