对于IBM.WMQ .Net参考,为什么我的代码未加载特定于应用程序的amqmdnet.dll版本?

问题描述 投票:0回答:1

我有一个定制版本的amqmdnet.dll,在我的项目中本地引用了该版本,并与应用程序一起部署。

这是在运行我们的应用程序并与IBM队列交互的服务器的日志中

System.IO.FileLoadException: Could not load file or assembly '' or one of its dependencies. 
         General Exception (Exception from HRESULT: 0x80131500)
         File name: 'amqmdnet, Version=7.5.0.0, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97'
            at IBM.WMQ.MQDestination.Put(MQMessage message)

但是,项目文件(.csproj)引用了完全不同的amqmdnet.dll版本

<Reference Include="amqmdnet, Version=9.0.5.0, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>IBM\amqmdnet.dll</HintPath>
    </Reference>

我们在这里要解决许多问题

  • 在服务器日志中,即使我们已经部署了9.0.3.0版本,为什么amqmdnet dll的版本号也显示为7.5.0.0,且具有相同的公共密钥令牌?服务器上未安装IBM客户端(这是准系统Azure容器)。
  • 仅在调用Put方法时抛出该异常。在此之前,发生了很多初始化而没有问题,例如。 MQQueue对象的初始化等等。为什么正确的程序集(9.0.3.0)的Put方法尝试从其他程序集版本(7.5.0.0)调用方法?
.net websphere ibm-mq .net-assembly assemblies
1个回答
0
投票

创建具有如下内容的app.config,以确保程序使用amqmdnet.dll的特定版本。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="amqmdnet" publicKeyToken="dd3cb1c9aae9ec97" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-9.0.3.0" newVersion="9.0.3.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>
© www.soinside.com 2019 - 2024. All rights reserved.