BadImageFormatException. This will occur when running in 64 bit mode with the 32 bit Oracle client components installed

后端 未结 21 2182
南方客
南方客 2020-11-21 13:30

I am getting this error while on of my .Net application are trying to make a connection to oracle database.

The error says that This problem will

相关标签:
21条回答
  • 2020-11-21 13:54

    As it was pointed out in the comments, System.Data.OracleClient is deprecated. There is little reason to start using it so late in the game.

    Also as pointed out in the comments (I've marked this as community wiki in observence), there is now a managed provider as part of the 12c and later versions of the odp.net package. This provider does NOT require any unmanaged dlls so this should be a non issue in that case.

    If you would prefer to use the old unmanaged Oracle.DataAccess provider from oracle, the simplest solution is to set the "DllPath" configuration variable:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <oracle.dataaccess.client>
        <add key="DllPath"            value="C:\oracle\bin"/>
      </oracle.dataaccess.client>
    </configuration>
    

    See "Search Order for Unmanaged DLLs" in http://docs.oracle.com/database/121/ODPNT/InstallODP.htm for more information

    0 讨论(0)
  • 2020-11-21 13:54

    this solution work for me ,

    To revise IIS

    Select Application Pools.
    Clic in ASP .NET V4.0 Classic.
    Select Advanced Settings.
    In General, option Enable 32-Bit Applications, default is false. Select TRUE.
    Refresh and check site.
    

    Comment:

    Platform: Windows Server 2012 Standart- 64Bit - IIS 8

    0 讨论(0)
  • 2020-11-21 13:54

    I had this error in my DNN application installed on Windows 2012 R2. It's using some 32 bit dll and only Oracle.DataAccess.dll x32 was working. My solution is:

    1. Uninstall old Oracle Client \ ODAC.
    2. Install Oracle 11 Client x32.
    3. Install Oracle ODAC 12 x64.
    4. Check IIS Application Pool (Classic version) has option "Enable 32-Bit Applications" = true.
    0 讨论(0)
  • 2020-11-21 13:54

    I got this issue for a console Application.

    In my case i just changed the Platform Target to "Any CPU" which you can see when you right click your solution and click on properties , you will find a Tab "Build" click on it, you will see "Platform target:" change it to "Any CPU", which will solve your issue

    0 讨论(0)
  • 2020-11-21 13:55

    I had the same issue on a Windows 10 PC. I copied the project from my old computer to the new one, both 64 bits, and I installed the Oracle Client 64 bit on the new machine. I got the same error message, but after trying many solutions to no effect, what actually worked for me was this: In your Visual Studio (mine is 2017) go to Tools > Options > Projects and Solutions > Web Projects

    On that page, check the option that says: Use the 64 bit version of IIS Express for Websites and Projects

    0 讨论(0)
  • 2020-11-21 13:56

    I developed desktop application using C#.net with 2.0 framework along with system.data.oracleclient for connecting oracle db and I was facing similar error message ,"Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed."

    following solutions were applied

    • Project, properties, Build TAB, select platform target : x86
    • Project, clean build, ReBuild solution
    • Install Oracle 11G*32 bit client

    now, it work because application is set for 32bit and oracle 32bit client installed over Win2012 R2 server, hopefully will work for you.

    0 讨论(0)
提交回复
热议问题