问题
I have a very simple .Net Core app trying to create and open a connection to a DB2 database (on AS/400). I have this error when I try to create the DBConnection object, with the message:
ERROR 58005 SQL0902 There are no context policies. Function: AESEncryptADONet
.
There are no more details, unfortunately.
回答1:
We meet the same error and solved it by setting Path
of environment variables on Windows / Linux (LD_LIBRARY_PATH
) / MacOS (DYLD_LIBRARY_PATH
).
For example:
- Our environment:
- ASP.NET Core v3.1
- IBM .NET Core 3.1 / EntityFrameworkCore 3.1 in v11.5.4
- IIS 8.5
- Windows Server 2012 R2 (64 bits)
- In web.config, we add the
<environmentVariable name="Path" value="C:\Users\Administrator\.nuget\packages\ibm.data.db2.core\3.1.0.200\buildTransitive\clidriver\bin" />
.<?xml version="1.0" encoding="utf-8"?> <configuration> <location ... > <system.webServer> ... <aspNetCore ... > <environmentVariables> <environmentVariable name="Path" value="C:\Users\Administrator\.nuget\packages\ibm.data.db2.core\3.1.0.200\buildTransitive\clidriver\bin" /> </environmentVariables> </aspNetCore> </system.webServer> </location> </configuration>
- Set folder permissions (Read & Execute, Read, and List Folder Contents) for Application Pool Identity Accounts (
IIS AppPool\[App_Pool_Name]
)
Please click the links below for more information.
- Frequently asked questions about IBM Db2 .NET Core Provider
Q: I am getting the following error:
An unexpected exception has occurred in Process: 244 Function: AESEncryptADONET (Encryption Info)
The .NET driver is unable to find the compatible GSKit. Set the
Path
(on Windows) orLD_LIBRARY_PATH
(on Linux) to the<Package_Install_location>/<package-name>/<version>/build/clidriver/lib
directory of your environment. Remember, this may affect other applications. - Db2 .NET Packages downloading and initial configuration
来源:https://stackoverflow.com/questions/63175964/db2-net-connector-error-aesencryptadonet