cancel
Showing results for 
Search instead for 
Did you mean: 

ADO.NET Hana client in Microsoft IIS Security Exception

d_curioni9
Explorer
0 Kudos

Hi,

I am trying since one year to use the Hana client (currently version 2.6.64.0) for .Net Framework in a c# application that runs in IIS. This is a huge application referencing a lot of external dll's without any problem. I am only having problems with the Hana client.

The application runs in Microsoft IIS x64 on my development machine (Windows 10) under user impersonation, with active directory authentication.

I tried both referencing the Sap.Data.Hana.v4.5 assembly from the GAC and adding it to the /bin directory. I always get this error when I try to open the HanaConnection:

Stack trace:

[SecurityException: Access to system registry denied.]
   System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +60
   Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +14174043
   System.Environment.GetEnvironmentVariable(String variable, EnvironmentVariableTarget target) +277
   Sap.Data.Hana.HanaUnmanagedDll.SearchNativeDlls() +306
   Sap.Data.Hana.HanaUnmanagedDll..ctor() +18
   Sap.Data.Hana.HanaUnmanagedDll.get_Instance() +133
   Sap.Data.Hana.HanaConnection..cctor() +56

Version information:

Versione di Microsoft .NET Framework:4.0.30319; Versione di ASP.NET:4.8.4250.0

The code I use is:

using HanaConnection hcn = new HanaConnection("UserID=...;Password=...;Server=x.x.x.x:30015;DATABASE=...");
hcn.Open();

I worked around this issue using a connection to a Microsoft SQL Server instance, linked to the Hana server, and querying through OPENQUERY, but this is less than ideal (a lot of escaping is needed, I cannot use parameters, call stored procedures, ...).

There is no option to run the site under a different security context, the user impersonation is required in the application. Also, the same site connects to Microsoft SQL server and Pervasive SQL server through their native DLL's without glitches.

I also tried to publish the same test page on a development server (Windows Server 2019) running the same application under the same AD where I authenticate with the same SID. There I get a totally different error, but no issue accessing registry keys.

[HanaException (0x80004005): general error: database '...' not connected]

   Sap.Data.Hana.HanaConnection.Open() +2141


Thanks for any help.
Davide

Accepted Solutions (0)

Answers (1)

Answers (1)

jeff_albion
Advisor
Advisor

Hello Davide,

Yes, I very much agree this is a problem with the HANA ADO.NET driver: I have opened issue #262722 to be address in the driver for a fix.

I will let you know when the fix is available - thanks!

Best regards,
Jeff

jeff_albion
Advisor
Advisor

Hello,

This issue has now been fixed in the 2.7.24 driver and higher. The 2.7.26 HANA Client was released today for download.

Best regards,

Jeff

d_curioni9
Explorer
0 Kudos

Thank you Jeff. I would really like to try it, but I cannot find a download location. The one I normally use (https://tools.hana.ondemand.com/#hanatools) is still showing 2.7.23. Elsewhere I see that the current release is 2.8.16, but with my S- account I cannot find a way to download it.

Thanks.

Davide

d_curioni9
Explorer
0 Kudos

Fixed! The page has been updated and shows 2.7.26. The problem is fixed, thanks!