IBM.Data.DB2.Core throws exception in azure function app

一曲冷凌霜 提交于 2020-06-17 13:26:28

问题


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: 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'.

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?


回答1:


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 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.

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.



来源:https://stackoverflow.com/questions/60458243/ibm-data-db2-core-throws-exception-in-azure-function-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!