0

I am trying to create a WCF service to host in IIS.
My production and development servers are 64 bit.

The WCF service needs to be able to connect to a several different Oracle databases based on the client request.

I am using Entity Framework 5 with ODAC, and with the DbContext Initialiser, I have the option of providing a database connection to use.

private void ExampleSelect(string dataSource, string user, string password)
{
    var connection =
        string.Format("DATA SOURCE={0};PASSWORD={1};USER ID={2}",
                          dataSource, password, user);

    using (var context = new OracleDbContext(new OracleConnection(connection)))
    {
        // do stuff here
    }
}

The problem I have lies with new OracleConnection(connection). To use this line, I need to reference the x64 version of Oracle.DataAccess.dll

When I come to publish, I get the warning:

warning

and the error:

error

The platform target for my project is currently 'Any CPU'. If I change this to target x64, I get the same error, but this time it refers to my project and not Oracle.DataAccess

error2

Any of the above builds successfully on my development machine, I only get the errors when I come to publish.

What am I doing wrong here?

These solutions appear to be related, but they all refer to 32 bit Oracle Dlls:

Could not load file or assembly Oracle.DataAccess

Could not load file or assembly 'Oracle.DataAccess' 64 bit ODP.NET

Could not load file or assembly 'Oracle.DataAccess error

To rule it out, I have also tried installing both the 64bit and 32bit Oracle Clients on the development server, but I still don't get as far as even publishing so I'm not sure that the server is the cause of the problem.

The Enable 32 bit Application property on the Application pool in IIS does not make any difference, but I tried it anyway.

Community
  • 1
  • 1
philreed
  • 2,497
  • 5
  • 26
  • 55
  • Check if in bin directory of online server there is an oracle.dataaccess.dll – bdn02 Feb 13 '14 at 17:31
  • The point is that I cannot publish to the server if this dll is referenced. So unfortunately, nothing gets put on the server. – philreed Feb 13 '14 at 18:13

1 Answers1

0

To eliminate your problem you must meet the following conditions. Since you want everything run in x64:

1.Make sure that you have installed 64-bit Oracle client software

2.Make sure that you using 64-bit Oracle.DataAccess.dll (use corflags to verify)

3.Make sure you build your application with x64 configuration

4.Disable Enable 32 bit Application on IIS pool

This is a common mistake by many people. They install 32-bit client and try to run x64 Oracle.DataAccess

T.S.
  • 18,195
  • 11
  • 58
  • 78