DB2 .Net Connector error : AESEncryptADONet

人盡茶涼 提交于 2021-02-17 05:33:06

问题


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:

  1. 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)
  2. 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>
    
  3. 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) or LD_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

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