如果您知道如何解决此问题,请提供帮助。
VS 2015 Nuget包管理器已安装 - EntityFramework 6.1.3 + IBM DB2 EntityFramework 6.0.6 从数据库创建的EDMX文件。
错误
public partial class dbb1Entities : DbContext
{
public dbb1Entities()
: base("name=dbb1Entities"){}
}
错误:
实体框架提供程序类型' IBM.Data.DB2.EntityFramework.DB2ProviderServices,IBM.Data.DB2.EntityFramework,Version = 10.5.5.6,Culture = neutral,PublicKeyToken = 7c307b91aa13d208' 在具有不变名称' IBM.Data.DB2'的ADO.NET提供程序的应用程序配置文件中注册无法加载。 确保使用了程序集限定名称,并且程序集可供正在运行的应用程序使用。 有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=260882。
Web.config详细信息
<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>
<connectionStrings>
<add name="dbb1Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=IBM.Data.DB2;provider connection string="Database=dbb1;User ID=Dev;Password=AABCDEF;CurrentSchema=bx00001;Server=db2:50000"" providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="IBM.Data.DB2" type="IBM.Data.DB2.EntityFramework.DB2ProviderServices, IBM.Data.DB2.EntityFramework, Version=10.5.5.6, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
</providers>
</entityFramework>
&#13;
计算机配置详细信息
<add name="IBM DB2 .NET Data Provider 10.5.0" invariant="IBM.Data.DB2.10.5.0" description="IBM DB2 Data Provider 10.5.0 for .NET Framework 4.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2.10.5.0, Version=10.5.0.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
<add name="IBM DB2 .NET Data Provider 10.5.7" invariant="IBM.Data.DB2.10.5.7" description="IBM DB2 Data Provider 10.5.7 for .NET Framework 4.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2.10.5.7, Version=10.5.7.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
<add name="IBM DB2 .NET Data Provider 11.1.1010" invariant="IBM.Data.DB2.11.1.1010" description="IBM DB2 Data Provider 11.1.1010 for .NET Framework 4.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2.11.1.1010, Version=11.1.1010.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
<add name="IBM DB2 .NET Data Provider" invariant="IBM.Data.DB2" description="IBM DB2 Data Provider for .NET Framework 4.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2, Version=9.7.4.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
<add name="IBM DB2 .NET Data Provider 10.5.6" invariant="IBM.Data.DB2.10.5.6" description="IBM DB2 Data Provider 10.5.6 for .NET Framework 4.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2.10.5.6, Version=10.5.6.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
&#13;
答案 0 :(得分:1)
我在使用类似的设置VS2015,EntityFramework 6.2,EntityFramework.IBM.DB2 6.1时遇到了完全相同的问题,但是我设法解决了该问题。
我注意到对.net 4.6.1的引用,将目标框架从4.5.1更改为4.6.1后,问题已解决!
发布在对我有用的IBM应用程序版本/设置下面。
Machine.config
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<add name="IBM DB2 .NET Data Provider" invariant="IBM.Data.DB2" description="IBM DB2 Data Provider for .NET Framework 4.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2, Version=9.7.4.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
<add name="IBM Informix .NET Data Provider" invariant="IBM.Data.Informix" description="IBM Informix Data Provider for .NET Framework 4.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix, Version=9.7.4.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
<add name="IBM DB2 .NET Data Provider 10.5.6" invariant="IBM.Data.DB2.10.5.6" description="IBM DB2 Data Provider 10.5.6 for .NET Framework 4.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2.10.5.6, Version=10.5.6.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
<add name="IBM Informix .NET Data Provider 10.5.6" invariant="IBM.Data.Informix.10.5.6" description="IBM Informix Data Provider 10.5.6 for .NET Framework 4.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix.10.5.6, Version=10.5.6.4, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
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"/>
<provider invariantName="IBM.Data.DB2" type="IBM.Data.DB2.EntityFramework.DB2ProviderServices, IBM.Data.DB2.EntityFramework, Version=10.5.5.6, Culture=neutral, PublicKeyToken=7c307b91aa13d208"/>
</providers>