我最近将一个老项目的Entity Framework版本从4或5更新到了版本6。现在我遇到了这个异常:
发生了类型为 'System.InvalidOperationException' 的异常,但未在用户代码中处理,位于 EntityFramework.dll 中。
额外信息:找不到与不变名称为'System.Data.SqlClient'的 ADO.NET 提供程序对应的Entity Framework提供程序。确保该提供程序已在应用程序配置文件的 'entityFramework' 部分中注册。请参见http://go.microsoft.com/fwlink/?LinkId=260882 获取更多信息。
我在Google上搜了这个错误,并浏览了一些SO讨论串,但是其中没有一个可以解决我的问题。这是我的App.config文件的内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<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>
</configuration>
我已经从我的项目中卸载了Entity Framework并重新安装了它,删除了所有旧EF文件的引用并重新安装了它,但对我来说什么都不起作用。 我一直收到这个错误。