BizTalk 2020 Oracle错误:无法加载一个或多个请求的类型,检索LoaderExceptions属性以获取更多信息

uqxowvwt  于 2023-05-22  发布在  Oracle
关注(0)|答案(1)|浏览(147)

获取此错误:

Error Description: System.Reflection.ReflectionTypeLoadException: 
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Server stack trace: 
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Microsoft.Adapters.OracleDB.OracleDBConnectionFactory.LoadUdtAssemblies(String UserAssembliesLoadPath)
   at Microsoft.Adapters.OracleDB.OracleDBConnection.Microsoft.ServiceModel.Channels.Common.IConnection.BuildHandler[TConnectionHandler](MetadataLookup metadataDictionary)
   at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnectionHandler[TConnectionHandler](Guid clientId, TimeSpan timeout, MetadataLookup metadataLookup, String& connectionId)
   at Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open()

在上面的堆栈跟踪中,我们看到这个程序:所以我相信它在尝试为UDT(用户定义类型)加载.DLL时会出错。
但这是整个情况。此应用程序在BizTalk 2016上运行良好。我运行GacUtil将完全相同的DLL放入BizTalk 2020上的GAC中。
从应用程序中的模式来看,UDT在请求中,而不是在响应中。BizTalk业务流程正在发送要插入或更新的多行数据。
发送端口具有在userAssembliesLoadPath属性中指定的正确的.dll名称:C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Oracle_ZEMA_XXCMI_PowerDataUserTypes_v0101\v4.0_0.0.0.0__81552c10a3b36c51\Oracle_ZEMA_XXCMI_PowerDataUserTypes_v0101.dll
我还为这个特定的SendPort创建了一个单独的主机示例。现在我把它设置为32位,但我也试过64位。
我们还有一个应用程序使用了不同的UDT.dll文件,它工作正常.
我尝试使用Visual Studio 2019重建.dll。我完成了“添加生成的项”、“添加适配器元数据”,并使用WCF-OracleDB作为适配器。它生成了架构,但没有生成. DLL。这是第二个问题。
错误提示为“检索LoaderExceptions属性”。我今天花了一些时间试图捕捉一个更好的异常并找到该属性,但没有成功。我们对System.Exception的捕获是触发,我们有代码可以做到这一点:

"ExceptionType=" + System.Convert.ToString(exException.GetType()) +

这在我们的跟踪中显示:
ExceptionType=Microsoft.XLANGs.Core.XlangSoapException
我在作用域形状中添加了两个新的catch块(在System.Exception上面),但都没有捕获任何内容,只有System. Exception。

  1. System.Reflection.ReflectionTypeLoadException
    1.双向发送端口Soap 1.1出错(尚未尝试1.2)
    我已经检查了InnerExeption,它是null。异常类型为:Microsoft.XLANGs.Core.XlangSoapException.我也试过这个:
exBase = exException.GetBaseException(); 
tempExceptionText = tempExceptionText + 
        "\r\nBase ExceptionType=" +  
            System.Convert.ToString(exBase.GetType());

但这也表明:基本ExceptionType=Microsoft.XLANGs.Core.XlangSoapException

7fhtutme

7fhtutme1#

我认为这是答案的开始,我会在结束时补充更多。
基于@nimmat的回答:如何诊断Resharper Unit Test Runner“无法加载一个或多个请求的类型”错误
我创建了以下PowerShell脚本来尝试重新创建问题:

function GetTypes($path) {
   [Reflection.Assembly]::LoadFile($path) | % {$_.GetTypes()}
   $Error[0].Exception.InnerException.LoaderExceptions
}

cls

Write-Host "-----------LANDMGT-----------"
$path = "c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Oracle_LandMgt_APPS_XXCHEN_LMS_INV_TRX_PKG_v0101\v4.0_0.0.0.0__81552c10a3b36c51\Oracle_LandMgt_APPS_XXCHEN_LMS_INV_TRX_PKG_v0101.dll"
GetTypes($path) 

Write-Host 
Write-host "-----------ZEMA-----------"
$path = "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Oracle_ZEMA_XXCMI_PowerDataUserTypes_v0101\v4.0_0.0.0.0__81552c10a3b36c51\Oracle_ZEMA_XXCMI_PowerDataUserTypes_v0101.dll"
GetTypes($path)

我得到的每一个错误都是相同的,这意味着我对LandMgt业务流程的测试可能没有运行Oracle逻辑。
输出:

-----------ZEMA-----------
Exception calling "GetTypes" with "0" argument(s): "Unable to load one or more of the requested types. Retrieve the 
LoaderExceptions property for more information."
At D:\Scripts\TestLoaderExceptions.ps1:3 char:48
+    [Reflection.Assembly]::LoadFile($path) | % {$_.GetTypes()}
+                                                ~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ReflectionTypeLoadException
 
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Oracle.DataAccess, Version=4.121.1.0, Culture=neutral, 
PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

基于上述内容,我更改了machine.config(因为我使用的是32位主机示例):c:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config添加第二个重定向:
但现在得到一个新的错误:

Error Description: Microsoft.ServiceModel.Channels.Common.MetadataException: Metadata resolution failed for OperationId: "http://Microsoft.LobServices.OracleDB/2007/03/XXCMI/Procedure/CHN_POWER_FWD_PRICES_SP". ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Oracle.DataAccess.Client.OracleLogicalTransaction..ctor(OracleConnection connection, Byte[] ltxid)
   at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable, OracleLogicalTransaction m_OracleLogicalTransaction)
   at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src, OracleLogicalTransaction m_oracleLogicalTransaction)
   at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
   at Oracle.DataAccess.Client.OracleConnection.Open()
   at Microsoft.Adapters.OracleCommon.OracleCommonConnectionWrapper..ctor(String connectionString, OracleCommonExecutionHelper executionHelper)
   at Microsoft.Adapters.OracleDB.OracleDBConnection.OpenConnection(OracleCommonExecutionHelper executionHelper)
   --- End of inner exception stack trace ---

相关问题