views:

2170

answers:

3

Hi,

I have an web application which uses Oracle.DataAccess.dll to communicate with and Oracle db. The web application deployed on 32 bit windows system works but not on windows server 2008 64 bit. I installed 10204_vista_win2k8_x64_production_db package, referenced the installed dll (version 2.102.4.0) from the project but I get the following error:

Could not load file or assembly 'Oracle.DataAccess, Version=2.102.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.

Any help is appreciated. Thanks in advance.

+1  A: 

Same here. The Oracle.DataAccess assembly doesn't run in 64 bit mode.

You should set the application pool for your site to 32 bit mode (go to the application pool's Advanced Settings and set Allow 32 Bit Applications to "True")

If that doesn't work, make sure your Oracle directory (the directory containing all the Oracle dlls) is in your system path. If you forget that, you get the same cryptic error about not finding Oracle.DataAccess.

EDIT:

Installing the Oracle client can be a major pain. Using the Oracle Instant Client is somewhat easier than installing the full client, so this is what I usually do:

  1. Download the Oracle Instant Client
  2. Unzip the archive in c:\oracle (any other directory will do)
  3. Open a command prompt as administrator
  4. type cd \oracle
  5. type configure odp.net20 myhome
  6. Right-click on "My Computer", "Advanced System Settings", "Environment Variables" and add the C:\oracle directory to the system path
  7. Copy the Oracle.DataAccess.dll file from c:\oracle\odp.net\bin\2.x to your application's bin folder
  8. (optonally) edit your c:\oracle\tnsnames.ora file
Philippe Leybaert
I set Enable 32 Bit Applications to true, but had no luck. I get the same error message.What else can I do ?
Zoliq
see my edit to the answer
Philippe Leybaert
Hi Leybaert,What exactly do you mean by "make sure your Oracle directory (the directory containing all the Oracle dlls) is in your system path" ?I installed ODAC 1020221 which installed the dlls to the following directory: e:\oracle\product\10.2.0\client_1\ODP.NET\bin\. The weird thing is that the dlls don't get registered into the GAC by this install, so I referenced explicitly the dll from the project by its absolute path. Anyway, I get the same error message I mentioned in my previous post.What am I doing wrong ?
Zoliq
+1  A: 

I'm going to give you the answers from what I've just went through on Windows Server 2008 R2 which is a 64 bit operating system. The application suite of libraries I was given were developed using .net 3.5 x86 with the older DLL libraries and I was stuck because I had installed the newer x64 clients from oracle.

What I found was the following: Install the latest x64 client from Oracle for Windows Server 2008. I believe this would be the 2.7.0 client. When you select the installation, make sure you do custom and select the .NET libraries. Configure your tnsnames files and test your tnsping against your data source.

Next, if you are running a 32 bit application, install the same version of the client for 32 bit. Also, follow the same installation routine, and select the same home.

When your finished, you will find that you have a single app/product with two client directories (Client1 and Client2).

if you navigate to the windows/assemblies directory you will find that you have a reference to the Oracle.DataAccess.dll (x2) with one for x86 and one for AMD64.

Now, depending on if you have developers or are developing on the machine yourself, you may be ok here, however, if they are using older drivers, then you need to perform one last step.

Navigate to the app\name\product\version\client_1\odp.net\publisher policy\2.x directory. Included in here are two policy files. use gacutil /i to install the Policy.2.111.Oracle.DataAccess.dll into the GAC. This will redirect legacy oracle ODP calls to the newer versions. So, if someone developed with the 10g client, it will now work with the 11 client.

If you need further details, or need other questions answered like flipping 32 bit mode on or off on your .net assemblies, email me.

J Banks [email protected]

Good luck.

John Banks
Similar problem, worked like a charm
massimogentilini
A: 

If you can't have 32 bit oracle client working and installed 64 bit, you will need to install the 64 bit client, and grab the oracle.dataaccess.dll file under odp.net from the oracle client installed folder. And you have to use this dll and exchange the reference to this file instead of using 32 bit dll.( which is what you probably have for the project/solution)

If you have different bit of oracle client it's not going to work. so you will get errors like that. Hope that helps.

rlee923