通过nuget下载EF6并尝试运行我的项目后,它返回以下错误:
没有为ADO.NET提供程序找到具有不变名称"System.Data.SqlClient"的实体框架提供程序.确保提供程序已在应用程序配置文件的"entityFramework"部分中注册.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882.

我们正在使用EntityFramework 6和Code First.我们有一个控制台应用程序,它没有引用EntityFramework但是从其App.config读取连接字符串.它调用DatabaseInitializationUtilities程序集将连接字符串作为参数传递.
DatabaseInitializationUtilities引用了EF6(EntityFramework和EntityFramework.SqlServer).它的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>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IAuthentication" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/SecurityServices/Authentication.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAuthentication" contract="SecurityService.IAuthentication" name="BasicHttpBinding_IAuthentication" />
</client>
</system.serviceModel>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Run Code Online (Sandbox Code Playgroud)
执行到达DatabaseInitializationUtilities尝试运行脚本的行时
context.Database.ExecuteSqlCommand(script.ScriptText)
Run Code Online (Sandbox Code Playgroud)
抛出错误:
没有为ADO.NET提供程序找到具有不变名称"System.Data.SqlClient"的实体框架提供程序.确保提供程序已在应用程序配置文件的"entityFramework"部分中注册.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882.
我相信补救措施正是我在配置文件中所拥有的,所以我不明白这个问题.
注意:Resharper使节点变蓝并报告"元素'EntityFramework'具有无效的子元素'提供者'.但是,当我安装EF6时,NuGet会注入该部分.
有任何想法吗?
当我尝试调用WCF服务时,我收到以下消息"验证邮件的安全性时出错".
当我删除自定义验证时,服务没有问题.虽然我在web.config中配置错误,但我无法弄清楚.任何见解将不胜感激.
<system.serviceModel>
<services>
<service behaviorConfiguration="NAThriveExtensions.nableAPIBehavior"
name="NAThriveExtensions.nableAPI">
<endpoint
address=""
binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding_Secure"
contract="NAThriveExtensions.InableAPI">
</endpoint>
<endpoint
address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="NAThriveExtensions.nableAPIBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<userNameAuthentication
userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType= "NAThriveExtensions.Authentication, NAThriveExtensions" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_Secure">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud) 我已经将我的WCF项目发布到服务器上,我还在同一个盒子上发布了一个消耗WCF服务的MVC应用程序.
在我的MVC应用程序上尝试登录时,这会使用wcf服务,但我在浏览器上遇到此异常,
实体框架提供程序类型"System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer"在与固定名称"System.Data.SqlClient的" ADO.NET提供程序的应用程序配置文件中注册无法加载.确保使用了程序集限定名称,并且程序集可供正在运行的应用程序使用.
这是一个实体框架异常,但我假设因为我的项目已经在开发环境中引用了EF,在部署服务项目之后,DLL也应该包含EF引用,但我不知道为什么我会收到此错误.
我可以看到这条消息,因为我打开了 includeExceptionDetailInFaults="True"
我们正在从实体框架4切换到实体框架6.包管理器完成了它的工作,解决方案运行它的测试毫不费力.
但是在构建服务器上,我们得到以下运行测试的错误消息:初始化方法xxx.SetUp抛出异常.System.InvalidOperationException:
无法加载在具有不变名称"System.Data.SqlClient"的ADO.NET提供程序的应用程序配置文件中注册的实体框架提供程序类型"System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer".确保使用了程序集限定名称,并且程序集可供正在运行的应用程序使用.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882.
如果我们在构建服务器上本地打开解决方案,并在其中安装了Visual Studio,则测试将再次运行而不会出现错误.
我们将Cruise Control .Net与SVN结合使用,作为我们持续集成的工具.Build用于构建解决方案,测试与Ms Test一起运行.
有没有人遇到类似问题或对解决方案有任何想法?
我知道EF6 EntityFramework.SqlServer存在问题,并包含 var type = typeof(System.Data.Entity.SqlServer.SqlProviderServices);在上下文构造函数中.我在DEBUG模式下发布时工作正常.
仅在我以RELEASE模式发布时才出现以下错误.原因EntityFramework.SqlServer.dll在已发布的文件夹中丢失.但是,bin文件夹具有EntityFramework.SqlServer.dll,用于调试和释放模式.
错误:
实体框架提供程序类型"System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer"在与固定名称"System.Data.SqlClient的" ADO.NET提供程序的应用程序配置文件中注册无法加载.确保使用了程序集限定名称,并且程序集可供正在运行的应用程序使用.
为什么只有在我使用RELEASE模式发布时它才会丢失?
我的解决方案中有2个项目:第一个是ClassLibrary,第二个是我的Application.我在第二个项目中使用了Entity Framework(Code First方法)和Sql Server Compact.问题是如何在我的项目中使用相同的数据库?我试图将我的所有实体,DbContext和GenericRepository移动到我的库中,我也尝试在代码中设置连接字符串,但我一直收到IInvalidOperationException:
无法加载在具有不变名称"System.Data.SqlClient"的ADO.NET提供程序的应用程序配置文件中注册的实体框架提供程序类型"System.Data.Entity.SqlServer.SqlProviderServices,EntityFramework.SqlServer".确保使用了程序集限定名称,并且程序集可供正在运行的应用程序使用.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882.
这是我的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" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过实体框架使用类似于此的连接字符串连接到 Azure SQL 数据库:
Data Source=<server>.database.windows.net;Authentication=Active Directory Integrated;Initial Catalog=<database>
连接尝试是在 AutoCAD 2018 中运行的托管 WPF 表单的上下文中进行的。该项目是使用 .NET Framework 4.6 和 EF 6.1.3 构建的。
我遇到以下错误:
Unable to load adalsql.dll (Authentication=ActiveDirectoryIntegrated). Error code: 0x2. For more information, see http://go.microsoft.com/fwlink/?LinkID=513072
不幸的是,帮助链接没有指向提供此问题技术细节的页面。到目前为止,我还没有在网络上发现任何阐明根本原因的内容。
我也试过这个连接字符串:
Server=tcp:<server>.database.windows.net,1433;Initial Catalog=<database>;Persist Security Info=False;User ID=<username>;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Authentication="Active Directory Integrated"
它是从 Azure 门户的ADO.NET (Active Directory integrated authentication)部分复制而来的。但是,使用此连接字符串,我收到以下错误Cannot use 'Authentication=Active Directory Integrated' with 'User ID', 'UID', 'Password' or 'PWD' connection string keywords
但它不包含密码段。删除该User ID段后,我仍然收到Unable to load adalsql.dll ...错误消息。
当尝试添加此问题中列出的黑客时: 无法加载实体框架提供程序类型? 在这个答案: https: //stackoverflow.com/a/19130718/261405,我不断收到此错误: 命名空间名称“SqlServer”在命名空间“System.Data.Entity”中不存在
我正在开发一个 MVC 4 项目,该项目使用 EF 6 进行与数据库 (SQL Server) 之间的所有操作。我必须进行一些重构才能使用更明确的 Fluent API。基本上,现在项目中的每个实体都有其对应的所有映射的 Fluent API 代码。
当我尝试从包管理器控制台运行 EF 命令时,问题就出现了。这是我收到的错误: 在 SqlServer 提供程序清单中找不到存储类型“Varchar(100)”
这是错误的完整日志:
PM> enable-migrations
Checking if the context targets an existing database...
System.InvalidOperationException: The store type 'Varchar(100)' could not be found in the SqlServer provider manifest
at System.Data.Entity.Utilities.DbProviderManifestExtensions.GetStoreTypeFromName(DbProviderManifest providerManifest, String name)
at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.ConfigureColumn(EdmProperty column, EntityType table, DbProviderManifest providerManifest)
at System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration.<>c__DisplayClass47_0.<Configure>b__0(Tuple`2 pm)
at System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable`1 ts, Action`1 action)
at System.Data.Entity.ModelConfiguration.Configuration.Types.StructuralTypeConfiguration.ConfigurePropertyMappings(IList`1 propertyMappings, DbProviderManifest providerManifest, Boolean allowOverride)
at System.Data.Entity.ModelConfiguration.Configuration.Types.EntityTypeConfiguration.ConfigurePropertyMappings(DbDatabaseMapping databaseMapping, EntityType entityType, DbProviderManifest providerManifest, …Run Code Online (Sandbox Code Playgroud) c# sql-server asp.net-mvc entity-framework entity-framework-6
c# ×6
sql-server ×3
.net ×2
asp.net-mvc ×2
wcf ×2
ado.net ×1
asp.net ×1
msbuild ×1
mstest ×1
publish ×1
wcf-binding ×1
web-config ×1