相关疑难解决方法(0)

无法加载实体框架提供程序类型?

我正在尝试在我的机器上安装的TeamCity上运行我的测试.

System.InvalidOperationException:

实体框架提供程序类型" 为" 'ADO.NET提供程序无法加载.确保提供程序程序集可用于正在运行的应用程序.System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServerVersion=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'System.Data.SqlClient

有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882.

我没有参考System.Data.Entity任何我在codeplex上建议升级到EF6的项目.

所以,我不知道为什么我会得到这个例外.当我从VS运行测试时,我没有得到任何这样的异常.

我确实尝试将CopyLocal设置为false然后再次设置为true ..但这似乎也不起作用.

更新

我的app.config有以下内容.这会导致一些我不理解的行为吗?

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <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.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我在teamcity中得到以下stacktrace.

[MSTest] IntegrationTests.CrudTest+QuestionTest.Create
[03:59:11][IntegrationTests.CrudTest+QuestionTest.Create] Initialization method IntegrationTests.CrudTest+QuestionTest.Initialize threw exception. System.InvalidOperationException: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' for the 'System.Data.SqlClient' …
Run Code Online (Sandbox Code Playgroud)

c# mstest entity-framework teamcity-7.1 entity-framework-6

406
推荐指数
11
解决办法
26万
查看次数

不能将MySQL连接用于实体框架6

我正在尝试将实体框架6与MySQL一起使用.

我为visual studio 1.1.1和MySQL .Net连接器6.8.3安装了MySQL插件.

问题是当我尝试创建一个新的ADO.NET实体模型时,我无法为连接选择MySQL.

在此输入图像描述

但是,如果我从visual studio中的连接工具创建连接,我可以看到MySQL

在此输入图像描述

这意味着当前安装的版本与实体框架6不兼容.之后我安装了最新的连接器和插件怎么可能.还有什么可做的吗?

谢谢

编辑

我在没有安装默认连接器的情况下全新安装了MySQL,然后安装了6.8.3和visual studio的插件.

然后我可以看到我为我的实体模型建立的连接,但是当我即将选择实体版本时,我收到了这条消息.

在此输入图像描述

mysql entity-framework visual-studio-2013

56
推荐指数
3
解决办法
6万
查看次数

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

我最近在一个旧项目中将实体框架从版本4或5升级/更新到版本6.现在我得到了这个例外:

EntityFramework.dll中出现"System.InvalidOperationException"类型的异常,但未在用户代码中处理

附加信息:没有为ADO.NET提供程序找到具有不变名称"System.Data.SqlClient"的实体框架提供程序.确保提供程序已在应用程序配置文件的"entityFramework"部分中注册.有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=260882.

我用谷歌搜索了错误并遇到了几个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>
Run Code Online (Sandbox Code Playgroud)

我已经从我的项目中卸载了Entity Framework并重新安装了它,删除了所有对旧EF文件的引用并重新安装,但对我来说没有任何作用.我一直收到这个错误.

.net c# ado.net entity-framework entity-framework-6

44
推荐指数
6
解决办法
10万
查看次数

没有为ADO.NET提供程序找到具有不变名称"System.Data.SqlClient"的实体框架提供程序.

我们正在使用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会注入该部分.

有任何想法吗?

.net c# sql-server asp.net entity-framework-6

36
推荐指数
4
解决办法
7万
查看次数

为什么Run All会导致VS2012单元测试崩溃,但逐个运行却没有?

我们刚刚从Visual Studio 2008"升级"到Visual Studio 2012.我们更新了单元测试,现在它们在单独运行时通过但是当我尝试全部运行时,我收到以下错误:

The active Test Run was aborted because the execution process exited unexpectedly. To investigate further, enable local crash dumps either 
at the machine level or for process vstest.executionengine.appcontainer.x86.exe. Go to more details: [http://go.microsoft.com/fwlink/?linkid=232477][1]
Run Code Online (Sandbox Code Playgroud)

所以我转到链接并按照说明添加注册表项以启用本地故障转储.然后将错误消息更改为:

The active Test Run was aborted because the execution process exited unexpectedly. Check the execution process logs for more information. 
If the logs are not enabled, then enable the logs and try again.
Run Code Online (Sandbox Code Playgroud)

显然它注意到我在注册表中所做的更改以启用崩溃.但是,当我查看%LOCALAPPDATA%\ CrashDumps时,没有创建任何文件.

如果我一次运行一个测试(或者一次只进行几次测试),我可以让它们全部通过.问题仅在于全部运行.

有没有其他人遇到类似的问题?如果是这样,你是如何解决它们的?

基本上同样的问题在MSDN上 …

unit-testing visual-studio-2012

31
推荐指数
2
解决办法
1万
查看次数

找不到实体框架ADO.NET Sql.Data.Client提供程序

我有一个问题类似于 No Entity Framework提供者为ADO.NET提供程序找到的具有不变名称'System.Data.SqlClient'的问题,该错误有以下消息:

"具有不变名称'System.Data.SqlClient'的ADO.NET提供程序未在机器或应用程序配置文件中注册,或者无法加载.有关详细信息,请参阅内部异常."

正如相关问题的答案所示,我已经通过软件包管理器控制台重新安装了实体框架(EF6),但错误仍然存​​在.我还检查了我的项目中引用了EntityFramework.SqlServer.dll.这是存储在App.config中的连接字符串:

<add name="DesignModel"    ConnectionString="metadata=res://*/DesignModel.csdl|res://*/DesignModel.ssdl|res://*/DesignModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=C071E;initial catalog=CTD2;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />     
Run Code Online (Sandbox Code Playgroud)

我有另一个项目,我使用EntityFramework创建完全相同的实体和上下文,它工作正常,这使得这更令人费解.

尝试执行此行时会显示错误:

DesignModel designContext = new DesignModel();
designContext.MoPerfIDs.Load();
Run Code Online (Sandbox Code Playgroud)

其中DesignModel是继承DbContext的类的名称.

这是完整的App.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
       <section name="ppe.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
    <!-- 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>

  <connectionStrings>
    <add name="DesignModel" connectionString="metadata=res://*/DesignModel.csdl|res://*/DesignModel.ssdl|res://*/Design    Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=MONNMC071E;initial catalog=CTD2;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" …
Run Code Online (Sandbox Code Playgroud)

.net c# entity-framework

16
推荐指数
1
解决办法
4万
查看次数

vs2010单元测试毫无理由地中止

我们最近将TFS 2008服务器关闭了.它是使用TFS 2010服务器重建的.现在,当我选择VS单元测试并运行时,前几个标记为"已中止",其他标记为"未执行"...这种情况在没有任何输入的情况下发生.坠机前单元测试工作正常.可能导致什么?

谢谢.

unit-testing visual-studio-2010 tfs2010

5
推荐指数
1
解决办法
5313
查看次数

找不到实体框架提供程序 - 从VB6中调用C#Com DLL

我想在我的VB6应用程序中使用的C#Com可见DLL中使用EF6,但遇到错误.注意我没有使用app.config,而是从VB6程序传递连接字符串.

在C#代码中,我按如下方式访问DBContext;

private static MyDataEntities CreateDb()
{ 
    return new MyDataEntities(EFConnectionString);
}
Run Code Online (Sandbox Code Playgroud)

EFConnectionString是

"metadata=res://*/vivModel.csdl|res://*/vivModel.ssdl|res://*/vivModel.msl;provider=System.Data.SqlClient;provider connection string='data source=MYPC\SQL2008R2;initial catalog=MyDatabase;user id=sa;password=mypassword;MultipleActiveResultSets=True;App=EntityFramework'"
Run Code Online (Sandbox Code Playgroud)

错误消息是

[[指定的架构无效.错误:vivModel.ssdl(2,2):错误0152:找不到具有不变名称"System.Data.SqlClient"的ADO.NET提供程序的实体框架提供程序.确保提供程序已在应用程序配置文件的"entityFramework"部分中注册.有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882.]]

vb6 com entity-framework

1
推荐指数
1
解决办法
9174
查看次数