Could not load file or assembly ‘Oracle.DataAccess’ or one of its dependencies.

8

Friday, October 30, 2009 by Nandu

Working with 64 bit environment is a pain. Most of the drivers fail to work. After having a bad experience with Microsoft Jet driver, now it was Oracle.

The code I am working on makes use of ODP.NET 10g. There is a reference to the Oracle.DataAccess.dll and the “Copy Local” property in the references is set to true. When I ran this application in Windows XP (32 bit) things worked fine.

When I deployed the published code on the Windows 2008 64 bit environment, I got the following error message:

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.

On looking further I got to know all I had to do was remove the dll from the bin older so that the 64 bit version of the assembly could be used.

One issue resolved, some more to fix.

Alternatively, I haven’t tried this, but I suppose if I set the Application Pool in IIS 7 to 32 bit, this would still work.

8 thoughts on “Could not load file or assembly ‘Oracle.DataAccess’ or one of its dependencies.

  1. rajesh patel says:

    I develop my product portal .
    That is work fine in 32 bit system.
    But i deploy in 64 bit system there is one error.
    Error is ‘Could not load file or assembly ‘oracle.dataaccess’ or one of its dependencies. An attampt was made to load a program with an incorrect format’
    Please give me solution.

  2. GIBI ALEX says:

    if it is a console/windows application change the processor to x86 in the application properties and if it is in IIS , enable 32 bit in the advanced Properties.

  3. Merin Nakarmi says:

    I am also having same problem. I freshly installed Oracle 11g Release 2 on First Server which is Windows Server 2008R2. And I have Visual Studio 2010 on Second Server which is also Windows Server 2008R2. I installed 64 bit XCopy of ODP on Second Server which has visual studio. It was said that ODP will automatically add Oracle.DataAccess.dll to .NET. But when I see the References in my project, I could not find Oracle.DataAccess.dll. So I manually added Oracle.DataAccess.dll by browsing to the folder in which ODP was installed, in my case C:\Oracle\odp.net\bin\4\Oracle.DataAccess.dll

    The program builds successfully but gives error
    “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”

    Help please

  4. Brad Russell says:

    Enabling 32 bit applications in the app pool worked for me.

  5. jay says:

    You really saved my day. Thanks for providing such a simple solution. Otherwise, I would have done endless searches on Google for such a simple thing.

  6. Ozzie says:

    There are 32/64 bit scenarios which introduce build and runtime pitfalls for developers. The solution is always to try to get right what kind of software and OS you have installed. For a small list of scenarios with the Oracle driver and the solution, you can visit this post: http://rambletech.wordpress.com/2011/09/26/could-not-load-file-or-assembly-oracle-dataaccess-error/

  7. bingo says:

    I have been exploring for a little for any high-quality articles or weblog posts on this sort of space . Exploring in Yahoo I finally stumbled upon this site. Studying this info So i’m glad to convey that I’ve a very good uncanny feeling I came upon just what I needed. I so much no doubt will make sure to do not omit this website and provides it a look on a continuing basis.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: