0
votes

I am on a Windows 8.1 x64 machine and trying to connect to my locally installed Oracle 11g database through an ASP.NET WebForms 4 application that I am running from Visual Studio 2013 and IIS Express. I downloaded ODP.NET from this NuGet package. But I keep getting the error Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format.

Someone please help me troubleshoot this problem. There so little source code and sample out there regarding Oracle and .NET that is up to date.

2

2 Answers

2
votes

This usually happens when referencing an assembly that is either 32-bit from a 64-bit application or the inverse. Please make sure you're WebForm project is targeting the same platform as the referenced Oracle assembly.

0
votes

Quote from the page you downloaded your Oracle.DataAccess.dll:

Oracle will still need to be installed on the production or development machine in order to connect to Oracle (those libraries are greater than 100MB in size, so it didn't make sense to include them in a NuGet package), but this package will at least allow the project to be successfully built

So now you can only build your code, not run it. To run it you should get: 64-bit ODAC 11.2 Release 5 (11.2.0.3.20) for Windows x64 from this Oracle page: http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html

Your ASP.NET if installed so after your download and install it run command like this:

C:\oracle\product\11.2.0\client_1\odp.net\bin\4> OraProvCfg  /action:gac  /providerpath:"C:\oracle\product\11.2.0\client_1\odp.net\bin\4\Oracle.DataAccess.dll" 

(assuming your install directory will be C:\oracle\product\11.2.0\client_1\)