在x-64机器上的Oracle.DataAccess.Dll加载问题 [英] Oracle.DataAccess.Dll loading issue on x-64 machine

查看:248
本文介绍了在x-64机器上的Oracle.DataAccess.Dll加载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.net exe程序,它使用的是Oracle.DataAccess,Version = 2.121.1.0 dll。我的开发机器和tfs构建服务器都是32位的。一切都在32台机器上正常工作。
但现在我必须在x64(Windows Server 2012 R2)上迁移这个程序,我的所有问题都从那里开始。我得到着名的错误无法加载文件或程序集Oracle.DataAccess,Version = 2.121.1.0,Culture = neutral,PublicKeyToken = 89b483f429c47342或其依赖项之一。



我已经google了很多,尝试了各种各样的东西:


  1. 具体构建执行目标X86平台通过更改项目属性编译选项

  2. 我已经在机器上安装了Oracle dll,并在GAC中成功注册了

  3. 尝试构建可执行文件来定位任何CPU,当它没有工作时尝试X64以及

  4. 在app.config文件中提供了装配绑定信息,以查看加载dll的确切位置。

  5. 打开Fusion日志查看确切的失败原因

请看错误下面记录:



29/01/2015 10:57:30; ALERT; System.Exception catch in Main()29/01/2015 10:57:30;错误;系统tem.BadImageFormatException:无法加载文件或程序集Oracle.DataAccess,Version = 2.121.1.0,Culture = neutral,PublicKeyToken = 89b483f429c47342或其依赖关系之一。尝试加载格式不正确的程序。 XXXX.Common.Components.OraDataAccess..ctor()在XXXX.Library.ValuesCore.ValuesCore..ctor()的文件名:'Oracle.DataAccess,Version = 2.121.1.0,Culture = neutral,PublicKeyToken = 89b483f429c47342 .Library.DerivationsCore.Derivations..ctor()at XXXX.Processes.XXXX.Main.Main()===预绑定状态信息=== LOG:User = XX LOG:DisplayName = Oracle.DataAccess,Version = 2.121 .1.0,Culture = neutral,PublicKeyToken = 89b483f429c47342(完全指定)LOG:Appbase = file:/// D:/ Release / LOG:Initial PrivatePath = NULL调用程序集:XXXX.CommonComponents,Version = 1.0.0.0,Culture =中性,PublicKeyToken = e9b31bf34182bd8b。 === LOG:此绑定在默认加载上下文中启动。日志:使用应用程序配置文件:D:\Release\XXXX.exe.Config日志:使用来自C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine的机器配置文件的.config。 LOG:Post-policy reference:Oracle.DataAccess,Version = 2.121.1.0,Culture = neutral,PublicKeyToken = 89b483f429c47342 LOG:尝试下载新的URL文件:/// C:/Oracle/odp.net/bin/2.x /Oracle.DataAccess.dll。 ERR:无法完成装配设置(hr = 0x8007000b)。探测终止29/01/2015 10:57:30; ERROR;无法加载文件或程序集Oracle.DataAccess,Version = 2.121.1.0,Culture = neutral,PublicKeyToken = 89b483f429c47342或其依赖关系之一。尝试加载格式不正确的程序。 29/01/2015 10:57:30; ALERT;(全球)Point Source ID = 0,Calc Time = 29/01/2015 10:57:30。 29/01/2015 10:57:30;停止;



任何帮助将是非常需要的,将不胜感激。



谢谢

解决方案

Oracle.DataAccess.dll的体系结构(x86或x64)必须与安装的Oracle Client和它们都必须与部署的应用程序的体系结构相匹配(即是否在AnyCPU或x86或x64中编译)。



AnyCPU 将在64位Windows上定位到x64。



最好的解决方案是在您的机器上安装x86和x64 Oracle Client(和根据ODP.NET)那么任何组合都可以工作。以下是一条如何执行此操作的说明:安装Oracle x86和x64



替代解决方案是使用ODP.NET托管驱动程序,这在任何情况下都有效。您可以从这里下载: 64位Oracle数据访问组件(ODAC)下载


I have a .net exe program which is using Oracle.DataAccess, Version=2.121.1.0 dll. My development machine and tfs build server both are 32-bit. Everything is working fine on 32 machines. But now I have to migrate this program on x64 (Windows Server 2012 R2) and my all problems started from there. I am getting the famous error Could not load file or assembly 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies..

I googled a lot and tried various things so far:

  1. Specifically build the executeble to target X86 platform by changing the project properties Compile option
  2. I have installed the Oracle dll on the machine and it's successfully registered in the GAC
  3. Tried to build the executable to target 'Any CPU' and when it didn't work tried X64 as well
  4. Specifically supplied the assembly binding information in app.config file to look at the exact place for loading the dll.
  5. Turned on the Fusion log to see the exact failure cause

Please see the error log below:

29/01/2015 10:57:30;ALERT ;System.Exception caught in Main() 29/01/2015 10:57:30;ERROR ;System.BadImageFormatException: Could not load file or assembly 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format. File name: 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' at XXXX.Common.Components.OraDataAccess..ctor() at XXXX.Library.ValuesCore.ValuesCore..ctor() at XXXX.Library.DerivationsCore.Derivations..ctor() at XXXX.Processes.XXXX.Main.Main() === Pre-bind state information === LOG: User = XX LOG: DisplayName = Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342 (Fully-specified) LOG: Appbase = file:///D:/Release/ LOG: Initial PrivatePath = NULL Calling assembly : XXXX.CommonComponents, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e9b31bf34182bd8b. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\Release\XXXX.exe.Config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. LOG: Post-policy reference: Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342 LOG: Attempting download of new URL file:///C:/Oracle/odp.net/bin/2.x/Oracle.DataAccess.dll. ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. 29/01/2015 10:57:30;ERROR ;Could not load file or assembly 'Oracle.DataAccess, Version=2.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format. 29/01/2015 10:57:30;ALERT ;(Global) Point Source ID = 0, Calc Time = 29/01/2015 10:57:30. 29/01/2015 10:57:30;STOP ;

Any help would is desparately needed and will be greatly appreciated.

Thanks

解决方案

The architecture (x86 or x64) of Oracle.DataAccess.dll must match the architecture of installed Oracle Client and both of them must match the architecture of your deployed application (i.e. whether you compiled at "AnyCPU" or "x86" or "x64").

"AnyCPU" will target to x64 on a 64-bit Windows.

The best solution is to install both x86 and x64 Oracle Client (and according ODP.NET) on your machine, then any combination will work. Here is an instruction how to do this: Install Oracle x86 and x64

An alternativ solution is to use the ODP.NET Managed Driver, this works in any case. You can download it from here: 64-bit Oracle Data Access Components (ODAC) Downloads

这篇关于在x-64机器上的Oracle.DataAccess.Dll加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆