简体   繁体   English

实体框架错误:未找到具有不变名称'System.Data.SqlClient'的ADO.NET提供者的实体框架提供者

[英]Entity Framework error: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

I have the following MVC project structure: 我具有以下MVC项目结构:

BLL BLL

DAL DAL

CommonClasses CommonClasses

Web 卷筒纸

i'm using Entity Framework 6.0.2. 我正在使用Entity Framework 6.0.2。 The web project has a reference to the BLL and CommonClasses project. 该Web项目引用了BLL和CommonClasses项目。 BLL has a reference to DAL and CommonClasses. BLL引用了DAL和CommonClasses。 Both BLL and DAL also have references to EF 6.0.2, added via Nuget. BLL和DAL都还引用了通过Nuget添加的EF 6.0.2。 Anytime my code tries to do anything with Entity Framework I get the error below: 每当我的代码尝试使用Entity Framework做任何事情时,我都会收到以下错误:

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. 未找到具有不变名称“ System.Data.SqlClient”的ADO.NET提供程序的实体框架提供程序。 Make sure the provider is registered in the 'entityFramework' section of the application config file. 确保提供程序已在应用程序配置文件的“ entityFramework”部分中注册。

I'm a bit lost on what's happening. 我对正在发生的事情有点迷茫。 I have checked and there is a reference to EntityFramework.SqlServer in the DAL and BLL projects. 我已经检查过,并且在DAL和BLL项目中有对EntityFramework.SqlServer的引用。 All projects also have a reference to System.Data. 所有项目也都有对System.Data的引用。

The app.config file in both the DAL and BLL proejcts has the below line: DAL和BLL项目中的app.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>

Ensure that EntityFramework.SqlServer.dll is in the application directory for Web1 (ie in the bin folder). 确保EntityFramework.SqlServer.dll是在应用程序目录Web1 (在IE bin文件夹)。 It doesn't always get copied if the top-level executable/site doesn't have a direct dependency on this file. 如果顶级可执行文件/站点对此文件没有直接依赖关系,则它不会总是被复制。

Please see my SO answer here, which references a blog that was very helpful. 请在此处查看我的SO答案,该答案引用了一个非常有用的博客。 I had to do a couple of steps to get that DLL copied and loaded. 我必须执行几个步骤才能复制并加载该DLL。

Error: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient' 错误:未找到具有不变名称'System.Data.SqlClient'的ADO.NET提供程序的实体框架提供程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到具有不变名称'System.Data.SqlClient'的ADO.NET提供程序的实体框架提供程序 - Error: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient' 没有为ADO.NET提供程序找到具有不变名称“System.Data.SqlClient”的实体框架提供程序。 - No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. 找不到实体框架提供程序…不变名称为“ System.Data.SqlClient” - No Entity Framework provider found … with invariant name 'System.Data.SqlClient' System.InvalidOperationException:“没有为 ADO.NET 提供程序找到具有不变名称“System.Data.SQLite”的实体框架提供程序 - System.InvalidOperationException: 'No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SQLite' 未找到具有不变名称&#39;MySql.Data.MySqlClient&#39;的ADO.NET提供程序的实体框架提供程序-WCF - No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' - WCF 具有不变名称“System.Data.SqlClient”的 ADO.NET 提供程序未注册 - The ADO.NET provider with invariant name 'System.Data.SqlClient' is either not registered 找不到具有不变名称“Oracle.ManagedDataAccess.Client”的ADO.NET提供程序的实体框架提供程序 - No Entity Framework provider found for the ADO.NET provider with invariant name 'Oracle.ManagedDataAccess.Client' 找不到ADO.NET提供程序的实体框架提供程序 - No Entity Framework provider found for the ADO.NET provider 通用实体框架项目“没有为ADO.NET提供者找到实体框架提供者” - Common Entity Framework Project “No Entity Framework provider found for the ADO.NET provider” 未找到实体框架 ADO.NET Sql.Data.Client 提供程序 - Entity Framework ADO.NET Sql.Data.Client provider not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM