无法为具有固定名称“System.Data.SqlClient”的 ADO.NET 提供程序加载在应用程序配置文件中注册的实体框架提供程序类型“System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer ”。请确保使用限定程序集的名称且该程序集对运行的应用程序可用。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=260882。
1.在web.config添加
<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>
2.添加引用
为当前Web项目添加EntityFramework的引用即可(可通过NuGet查找并引用)。
链接地址:https://www.nuget.org/packages/EntityFramework/

本文介绍了解决在应用程序配置文件中注册的Entity Framework提供程序类型与ADO.NET提供程序加载冲突的方法。通过在web.config中正确配置entityFramework节,并确保引用了EntityFramework库,可以有效解决这一问题。
5570

被折叠的 条评论
为什么被折叠?



