locked
BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess' RRS feed

  • Question

  • User-1607455249 posted

    I have an application build from Visual Studio 8 that is using the System.Oracle.DataAccess library to talk to an Oracle DB. This dll is version 2.111.6.20 x86 version.

    When I run the application from Visual Studio, it connects, queries and displays the results correctly. This app is running on an Intel Xeon xw8600 processor using XP 2002.

    But when I deploy this app on an IIS web server that is running on an AMD processor using Windows 2003 server x64, I get the following error:

     

    BadImageFormatException: 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.] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, Visual Studio is running as a 32 bit application. I also installed ODAC Client 11.1.0.6.21 and win32_11gR1_client.zip for the Oracle Developer's Tools and Client.

     

    I also tried installing the same Oracle Client and Developer's Tools along with VStudio onto the my Windows 2003 server and my app ran fine running under the Visual Studio environment. But when I deployed the app onto the IIS server, I got the same type of error using Oracle.DataAccess version2.111.6.20 x86 version. I then copied over a 64bit version of this dll (version 2.111.6.0 AMD64) and rebuilt /redeployed the app got a different kind of error.

    [Exception: OCIEnvCreate failed with return code -1 but error message text was not available.] System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags) +736 System.Data.OracleClient.OciEnvironmentHandle..ctor(MODE environmentMode, Boolean unicode) +41 System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) +214 System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions) +157

     

    So all I'm trying to do is to get my app working in an IIS environment. It works when I run it under the VStudio environment on both my client box (x86) and server (x64).

    Can anyone help me on this?

    Thanks in advance....

    Thursday, November 19, 2009 5:35 PM

All replies

  • User-1947458356 posted

    Any solutions to this problem?? I have got the same problem

    Wednesday, February 1, 2012 4:44 AM
  • User-1598917946 posted

    try ading the dlls manually .. that is copy them from your code and add them to the published bin folder

    Wednesday, February 1, 2012 4:47 AM
  • User1469412963 posted

    Hi!

    I've struggled with this error for half a day. Thats what helped me:

    For x64 machine: 

    1. Find Oracle.DataAccess.dll in GAC (C:\Windows\Microsoft.NET\assembly\GAC_32\Oracle.DataAccess\)

    2. Copy to your dependencies folder (if any)

    3. Rebuild your project and copy dll to output dir

    Tuesday, December 18, 2012 8:35 AM