31

I have an asp.net mvc (EF) project , I had downloaded oracle data provider with version 4.112.2.50 -32bit on my pc when moving project to windows server 2008 (I have the same version of odp-64bit) I have the below problem:

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format.

when I toke Oracle the "Oracle.DataAccess.dll" from the server and make it with my project reference I have another error message like the above with a file "Oracle.Web"

Could not load file or assembly 'Oracle.Web' or one of its dependencies. An attempt was made to load a program with an incorrect format.

also if I get the File "Oracle.Web.dll" to my project reference from the server I have the same error with "Oracle.Web"

gdoron is supporting Monica
  • 136,782
  • 49
  • 273
  • 342
user975260
  • 315
  • 1
  • 4
  • 6
  • 1
    Check the points mentioned in http://stackoverflow.com/questions/8531475/oracle-dataaccess-dll-can-not-be-located-though-it-exists/8531874#8531874. Most likely it's a 32/64 bit issue. – Codo Dec 28 '11 at 22:24

6 Answers6

59

In the IIS Manager select your server and select "Application Pools". Select the application pool used by your Web App and click on "Advanced Settings" from the right hand menu.

In the "General Section" of the advanced Settings click on the "Enable 32-bit Applications" and set it to True.

This fix only applies to 64-bit servers that attempt to execute the 32-bit version of the Oracle Dlls.

Regards George

McHaroni
  • 606
  • 6
  • 4
6

George Wrote:

In the IIS Manager select your server and select "Application Pools". Select the application pool used by your Web App and click on "Advanced Settings" from the right hand menu.

In the "General Section" of the advanced Settings click on the "Enable 32-bit Applications" and set it to True.

This fix only applies to 64-bit servers that attempt to execute the 32-bit version of the Oracle Dlls.

The opposite is also true. If you are using the 64 bit version of the Oracle Dlls then you must set "Enable 32-bit Applications" to false.

--Jacob

Jacob
  • 385
  • 3
  • 16
3
  1. Oracle.DataAccess.dll must be installed not only referenced.
  2. Change the copy local property of the reference to true.
gdoron is supporting Monica
  • 136,782
  • 49
  • 273
  • 342
1

Incorrect Format indicates a bitness problem. To get the server running change the application pool your program is running in to enable 32 bit support or install a 64 bit oracle client.

tsells
  • 2,685
  • 1
  • 15
  • 20
0

Changing app pool from 64-bit to 32-bit is a solution.

Unihedron
  • 10,251
  • 13
  • 53
  • 66
0

Deleting bin and obj folders solved my problem.

Elvin Mammadov
  • 17,572
  • 9
  • 34
  • 76