6

I have to get a legacy application that uses unmanaged ODP.NET working on a 64-bit machine.

  1. I have installed 64-bit unmanaged ODP.NET
  2. I have verified that the 64-bit unmanaged ODP.NET is working fine by testing it in a console application
  3. I created a test web application with the same data access code as the working console application and a reference to the same Oracle.Data.Access DLL in the GAC that the console application uses. The web application is unable to connect to the database. The code snippet isn't relevant, as the code works and is very simple (see point 2.).

It fails at conn.Open();

Exception.Message is empty.

Exception.StackTrace is not useful:

 at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, 
    OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object 
    src, String procedure, Boolean bCheck, Int32 isRecoverable) at 
    Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, 
    OracleConnection conn, IntPtr opsErrCtx, Object src) at 
    Oracle.DataAccess.Client.OracleConnection.Open() at 
    TestODPNet.ODPNetTester.Test() in 
    D:\Projects\TestODPNet\TestODPNet\ODPNetTester.cs:line 27

The application is running on Local IIS, not IIS Express.

In IIS, "Enable 32-bit applications" is set to false.

The application is targeting x64-bit platform, not Any CPU.

Locally, I'm using 64-bit Windows 10 and on the server, I'm using 64-bit Windows Server 2012. I'm not able to get unmanaged ODP.NET working on either. So, it doesn't seem like this has to do with 32-bit binaries as far as I can tell since ODP.NET and both OSes are all 64-bit.

Edit: The application pool is (temporarily for a test) running using the same account as the console application, which is administrator on the machine.

What am I missing? How can I get unmanaged ODP.NET (64-bit) working in ASP.NET on 64-bit O/S?

Note: This question looks a bit similar to other questions, but it is not as far as I can tell

Note 2: Yes, I know that the recommended way is to use managed ODP.NET, but I do not have the source code and thus cannot make that change.

Zesty
  • 2,922
  • 9
  • 38
  • 69
  • 1
    Unmanaged ODP.NET is not one file. It is a whole collection of dependent files and config entries/registry entries. How did you get Oracle.DataAccess.dll on the machine? If you did not run the installer to put it there, you should. Also, let us know what version you are using. – Christian Shay Jul 09 '17 at 19:42
  • 1
    You should focus on the getting the exception to provide info as that will likely lead to a solution. Try catching an OracleException and see if that helps. – Christian Shay Jul 09 '17 at 19:50
  • @ChristianShay Thank you for responding. I installed ODP.NET through the installer. I changed the code to catch an OracleException. Exception.Message is still empty. Exception.InnerException is still null. The database version is 11.2.0.4.0 - 64bit. ODP.NET versions are 2.112.1.0 (AMD64) and 4.121.1.0 (AMD64) – Zesty Jul 10 '17 at 07:45
  • 1
    If you're running under IIS, you're likely not running under the same identity as the working console application. You could try running under the same identity: if this works, it would suggest that it's due to differences between the two accounts (registry settings, profile, permissions ...). – Joe Jul 11 '17 at 11:57
  • @Joe I already tried that, as a test. The application pool is running under my own account which is administrator on the machine. The account is also the same one that was used to run the console application. – Zesty Jul 11 '17 at 12:33
  • I assume you've seen this related thread https://stackoverflow.com/questions/6272190/how-to-make-odp-net-4-0-64-bit-working-on-64-bit-machine-windows-7 – Seano666 Jul 11 '17 at 15:17
  • You're running into the same problem as https://stackoverflow.com/q/12460384/495455 – Jeremy Thompson Jul 13 '17 at 05:01
  • Is there any information in the eventvwr? Otherwise, in order to find out what the difference is between your working console app and the misbehaving web app, I would suggest you get the big gun out and see which files get loaded or whether you have any e.g. permission related problems: https://technet.microsoft.com/de-de/sysinternals/processmonitor.aspx – dnickless Jul 17 '17 at 20:58

1 Answers1

0

I tried a simple application and it works as expected for me. My setup Win 8.1, IIS

Screen shot of the process's loaded DLLs after connecting to Oracle

enter image description here

    using (OracleConnection conn = new OracleConnection(connectionString))
    {
        conn.Open();
            
    }

Based on the ODP.Net documentation

Oracle Data Provider for .NET, Unmanaged Driver Assemblies

The Oracle.DataAccess.Client namespace contains ODP.NET classes and enumerations for the client-side provider.

I added a reference to Oracle.DataAccess.dll. This is the ONLY Oracle DLL reference in my project.

In my machine the DLL was in the following location

\product\12.2.0\client_1\odp.net\bin\4\Oracle.DataAccess.dll

I used this version from Oracle site for installation of ODP.Net

enter image description here

During installation, I specifically opted

(1) NOT to change machine.config

(2) NOT to install anything in GAC

So, things to try:

(1) Reference the assembly from the Oracle folder (instead of GAC)

(2) Install the latest available ODP.Net

Good luck

Community
  • 1
  • 1
Subbu
  • 2,130
  • 1
  • 19
  • 28