gpt4 book ai didi

c# - Oracle .Net 托管数据访问错误 : Could not load type 'OracleInternal.Common.ConfigBaseClass' from assembly

转载 作者:IT王子 更新时间:2023-10-29 04:18:07 25 4
gpt4 key购买 nike

我有一个在本地、在我们的开发服务器和生产服务器上运行的项目。

当我尝试在测试服务器上运行它时,出现以下错误,除了茫然地盯着屏幕外,我不知道该怎么办。提示?追溯问题源头的流程?

我已经为 Oracle 12.2 等安装了 NuGet 包。

Could not load type 'OracleInternal.Common.ConfigBaseClass' from assembly 'Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.TypeLoadException: Could not load type 'OracleInternal.Common.ConfigBaseClass' from assembly 'Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[TypeLoadException: Could not load type 'OracleInternal.Common.ConfigBaseClass' from assembly 'Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'.]
Oracle.ManagedDataAccess.EntityFramework.EntityFrameworkProviderSettings.Oracle.ManagedDataAccess.EntityFramework.EFProviderSettings.IEFProviderSettings.get_TracingEnabled() +0 Oracle.ManagedDataAccess.EntityFramework.EFProviderSettings.InitializeProviderSettings() +111 Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices..ctor() +629 Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices..cctor() +28

[TypeInitializationException: The type initializer for 'Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices' threw an exception.]
Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices.get_Instance() +24

Web.Config 中包含以下 block :

  <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" />
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>

  <oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="PVMDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=pdxcludds108.pacificorp.us)(PORT=11086))(CONNECT_DATA=(SERVICE_NAME=DDS1086.PACIFICORP.US))) " />
</dataSources>
</version>
</oracle.manageddataaccess.client>
<connectionStrings>
<add name="OracleDbContext" providerName="Oracle.ManagedDataAccess.Client" connectionString="User Id=USERID;Password=WORKINGPASSWORD;Data Source=PVMDataSource" />
<add name="PVMEntities" connectionString="metadata=res://*/Models.PVMModel.csdl|res://*/Models.PVMModel.ssdl|res://*/Models.PVMModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string=&quot;DATA SOURCE=pdxcludds108.pacificorp.us:11086/DDS1086.PACIFICORP.US;PASSWORD=XXXXXXX;PERSIST SECURITY INFO=True;USER ID=XXX&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

注意:还有其他项目在此服务器上工作,它们只是使用不同版本的 Oracle 客户端 for .Net。其他人都没有只使用托管驱动程序。我正在寻找一种方法来深入研究这个错误,一些关于该类型的来源和加载位置的提示。

最佳答案

NuGet 中的 Oracle.ManagedDataAccess 与服务器上安装(通过 Oracle 客户端安装)并在 GAC 中注册的之间存在冲突。

从 GAC 中取消注册 Oracle.ManagedDataAccess,您将摆脱错误:运行命令行并导航到目录:

{Oracle home}\product\{version}\client_64\ODP.NET\managed\x64

在那里你应该找到 OraProvCfg.exe 文件。运行以下命令从 GAC 中注销 Oracle.ManagedDataAccess:

OraProvCfg /action:ungac /providerPath:Oracle.ManagedDataAccess 

关于c# - Oracle .Net 托管数据访问错误 : Could not load type 'OracleInternal.Common.ConfigBaseClass' from assembly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30407213/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com