具有不变名称“Oracle.DataAccess.Client”的ADO.NET提供程序未注册

时间:2017-06-14 01:25:56

标签: c# .net oracle ado.net

我在VS2015中开发了基于实体框架的Web服务代码,该代码一直运行良好 - 直到我的系统被新系统替换。在一个全新的系统上,我无法在相同版本的Visual Studio中编译代码,即使我已经安装了所有依赖项 - 包括Oracle 11.2客户端运行时(说它,“安装用于开发应用程序的工具,网络服务和基本客户端软件“)。

当我在VS2015中构建解决方案时,抛出的错误是:Error 175: The ADO.NET provider with invariant name 'Oracle.DataAccess.Client' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.

双击错误将我带到指向的EDMX文件和EDMX文件标签StorageModels>架构:

<Schema Namespace="Model.Store" Alias="Self" Provider="Oracle.DataAccess.Client" ProviderManifestToken="11.2" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">

有趣的是,DLL文件被创建(尽管存在上述错误)但是当我用这个新文件替换服务器上的现有DLL时,似乎有问题从数据库中提取数据,如:

System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.
   at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
   --- End of inner exception stack trace ---
   at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
   at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
   at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
   at System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection)
   at System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config)
   at System.Data.Entity.Internal.LazyInternalConnection.Initialize()
   at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
   at System.Linq.Queryable.Where[TSource](IQueryable`1 source, Expression`1 predicate)
   at MyCo.MyDept.MyIntegration.MyService.DataAccess.DAL.GetLocation() in C:\Users\xxxx\MyCo.MyDept.MyIntegration.MyService\DataAccess\DAL.cs:line 17
   at MyCo.MyDept.MyIntegration.MyService.Utility.Helpers.GetLocations() in C:\Users\xxxx\MyCo.MyDept.MyIntegration.MyService\Utility\Helpers.cs:line 303
   at MyCo.MyDept.MyIntegration.MyService.KService.GetLocations() in C:\Users\xxxx\MyCo.MyDept.MyIntegration.MyService\KService.svc.cs:line 71

我已经尝试了其他类似线程中提供的解决方案,但它们似乎都不起作用。任何帮助表示赞赏。感谢。

1 个答案:

答案 0 :(得分:0)

检查配置文件中是否包含以下内容。如果没有,则添加它们。

  1. 具有托管数据访问权限<configSection>

        <configSections><section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /></<configSections>
    
  2. <entityFramework>

    下的提供者
    <entityFramework>
    <providers>
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    </providers></entityFramework>
    
  3. <system.data>下提供工厂详细信息

    <system.data>
    <DbProviderFactories>
      <remove invariant="Oracle.ManagedDataAccess.Client"/>
      <add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
    </DbProviderFactories>