IBM.Data.DB2.Core在Azure函数应用程序中引发异常 [英] IBM.Data.DB2.Core throws exception in azure function app

查看:122
本文介绍了IBM.Data.DB2.Core在Azure函数应用程序中引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用nuget包IBM.Data.DB2.Core版本1.3.0.100 dll将Azure函数中的DB2数据库与AzureFunctionsVersion V2连接起来。应用程序构建成功。

I'm using nuget package IBM.Data.DB2.Core version 1.3.0.100 dll to connect DB2 database from Azure functions with AzureFunctionsVersion V2. Application builds successfully.

当我运行应用程序并用邮递员将其击中时,我得到了例外:

When I run the application and hit it with Postman I get the exception:


System.Private.CoreLib:执行函数:Personal-GetAgencyDownload时发生异常。 AgencyDownload:无法加载文件或程序集 IBM.Data.DB2.Core,版本= 1.2.2.201,Culture = neutral,PublicKeyToken = 7c307b91aa13d208。无法找到或加载特定文件。 (来自HRESULT的异常:0x80131621)。 System.Private.CoreLib:无法加载文件或程序集'IBM.Data.DB2.Core,版本= 1.2.2.201,Culture =中性,PublicKeyToken = 7c307b91aa13d208'。

System.Private.CoreLib: Exception while executing function: Personal-GetAgencyDownload. AgencyDownload: Could not load file or assembly 'IBM.Data.DB2.Core, Version=1.2.2.201, Culture=neutral, PublicKeyToken=7c307b91aa13d208'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'IBM.Data.DB2.Core, Version=1.2.2.201, Culture=neutral, PublicKeyToken=7c307b91aa13d208'.

我看到了 1.3.0.100 软件包,没有其他软件包。为什么在运行时寻找 1.1.1.201

I see the 1.3.0.100 package, there isn't any other package. Why is it looking for 1.1.1.201 in runtime?

推荐答案

此如果您的 IBM.DataDB2.dll 文件位于DB2客户机安装位置以外的目录中,则可能会发生这种情况。这可能是在您不知道Visual Studio在哪里将必需的dll复制到项目的bin目录中的情况下发生的。

This could happen if you have the IBM.DataDB2.dll file lying around in directories other than the DB2 client install location. This could have happened without your knowledge where Visual Studio copies the necessary dll into the bin directory of the project.

IBM.Data.DB2.dll 依赖于DB2 Client安装中的其他客户端库。因此,仅从DB2 Client安装位置引用DLL,并且不要在应用程序目录中保存本地副本。

IBM.Data.DB2.dll has dependencies on other client libraries in DB2 Client installation. So refer the DLL from the DB2 Client installation location only and do not save a local copy in the application directory.

转到项目中的引用并设置将DB2 dll的本地复制到 false ,直接引用DB2客户端安装程序中的文件。

Go to the reference in the project and set Copy local to false for DB2 dlls, referencing directly the ones from the DB2 client setup.

这篇关于IBM.Data.DB2.Core在Azure函数应用程序中引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆