I am building ASP.NET application with C# and I want to connect to oracle database.
I have added reference to Oracle.DataAccess
in my application on my 64bit Microsoft Window Server 2008 machine.
I also installed ODAC (Oracle Data Access Component) on my machine
and Oracle.DataAccess.dll
is also present on this path
C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.DataAccess
but when i'm trying to connect i encounter following error:
Could not load file or assembly 'Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
As far as I know, the
Oracle.DataAccess
assembly works only with 32 bits, I also have this kind of problem with 64 bits and it really does not work. My solution was remove the 64bits from GAC and install the 32 bits on GAC. I also remove any .dll file in the bin folder to my application find the assembly on GAC.There is no problem if your machine and operational system is 64bits, the 32bits version will work fine.
UPDATE
I recommend you take a look at
Official Oracle ODP.NET, Managed Driver
, that is a better version thanOracle.DataAccess
. ThisManaged Driver
does not need theOracle Client
on the machine, and you just need to provide the TNS on the DataSource field of theconnection string
and it works fine for32
and64
bits.I got the same exception on a c# console app. What solved it for me is to change the platform target to x86. (project properties => build )
To resolve this error, I set my app pool in IIS to allow 32bit applications. Open up IIS Manager, right click on the app pool, and select Advanced Settings --> set “Enable 32-bit Applications” to True. It's working fine for me.
In VS2010, I changed the platform target to x64 and this error message disappear.
To run your website, you must use IIS since visual studio's development server only runs in 32 bit mode.
In IIS application pool, set your application to run in 64 bit. (The setting is in advanced settings)
essentially same error
missing ODP.NET installation components as per last post from me and the other answer participant.
You check the GAC yet?
If you do not see Oracle.xxx folders,
you are not making any headway.
put the correct version and bit of Oracle.DataAccess.dll into the application /BIN folder and make local reference. It solves many problems.