.net – Error using oracle.dataaccess.dll

64-bitnetodp.netoraclewindows

I have a web application which uses Oracle.DataAccess.dll to communicate with an 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.

Best Answer

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