无法加载文件或程序集“Oracle.DataAccess”或其中一个依赖项 [英] Could not load file or assembly "Oracle.DataAccess" or one of its dependencies

查看:2173
本文介绍了无法加载文件或程序集“Oracle.DataAccess”或其中一个依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行此Web应用程序。我一直收到这个错误
无法加载文件或程序集Oracle.DataAccess或其中一个依赖项。试图加载一个格式不正确的程序。
异常详细信息:System.BadImageFormatException。 无法加载文件或程序集Oracle.DataAccess或其依赖项之一。尝试加载格式不正确的程序。
以下是我已经尝试过的事情。

I am trying to run this web application. I keep getting this 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." Exception details: System.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." Below are the things that I already tried.

1)用32位oracle dll替换所有oracle dll,即2.112.3.0

1) replaced all the oracle dll's with 32 bit oracle dll i.e 2.112.3.0

我在64位机器上安装了32位客户端。操作系统是Windows 7.

I have 32 bit client installed on 64 bit machine. The operating system is windows 7.

2)单独编译每个项目。删除所有oracle依赖文件dll,然后单独添加2.112.3.0 dll,然后编译每个项目

2) compile each individual project individually. Deleted all the oracle dependent files dll and then added the 2.112.3.0 dll's individually and then compiled each project

3)使用此语句在GAC上注册32位dll $ b gacutil / i%ORA_HOME4%\odp.net \bin\4\Oracle.DataAccess.dll

3) Register the 32 bit dll on GAC using this statement gacutil /i %ORA_HOME4%\odp.net\bin\4\Oracle.DataAccess.dll

gacutil / i%ORA_HOME4%\\\p .net\bin\4\oracle.web.dll

gacutil /i %ORA_HOME4%\asp.net\bin\4\oracle.web.dll

对于上述两个语句,我从c:\Program Files复制了gacutil.exe( x86)\ Mysoftoft sdk\windows\v7.0A\Bin\NETFX4.0 Tools\X64
到C:\ drive然后

for the above two statements, I copied the gacutil.exe from c:\Program Files(x86)\Microsoft sdk\windows\v7.0A\Bin\NETFX4.0 Tools\X64 to C:\ drive and then

我执行了以上两个声明:

I executed the above two statement:

gacutil / i%ORA_HOME4%\odp.net \ bin\4\Oracle.DataAccess.dll
gacutil / i%ORA_HOME4%\\\p.net \bin \\\\oracle.web.dll
当我执行上述两个语句时,我没有得到任何消息,我执行了它们在管理员权限下的Dos窗口中。

gacutil /i %ORA_HOME4%\odp.net\bin\4\Oracle.DataAccess.dll gacutil /i %ORA_HOME4%\asp.net\bin\4\oracle.web.dll when I executed the above two statements, I didn't get any message, I executed them in Dos windows under administrator privilege.

4)我也删除了所有T来自此位置的临时ASP.net文件

4) I also deleted all the Temporary ASP.net files from this location

c:\ windows \ microsoft.Net \ V4.0.30319 \临时ASP.net文件
我还将Web应用程序构建平台目标更改为X86,最初,它位于ANy CPU。出于挫折感,我也尝试将平台目标更改为X64,然后我收到错误消息

c:\windows\Microsoft.Net\V4.0.30319\temporary ASP.net files I also changed the web application build Platform target to X86, Originally, it was at "ANy CPU". out of frustration, I also tried changing the platform target to X64 and then I got the error message saying

冷未加载文件或汇编.webapp或其中一个依赖。尝试加载格式不正确的程序。

" Cold not load file or assemble . webapp" or one of its dependencies. An attempt was made to load a program with an incorrect format.

我的计算机上没有安装IIS,我在visual studio 2010中运行此应用程序所以我我认为它将使用visual studio附带的内置IIS。

I don't have IIS installed on my computer, I am running this application in visual studio 2010 so I think it will be using the inbuilt IIS that comes with visual studio.

我花了很多时间来解决这个问题,但仍然一次又一次地得到同样的错误。

I spend lot of hours resolving this issue, but still getting the same error again and again.

任何帮助或提示都将受到高度赞赏。

any help or hint will be highly appreciated.

推荐答案

是否有问题当我从一台机器移动到另一台机器并重新安装所有设备时。就我而言,我正在使用32位和64位Oracle ODP.NET安装。

Had the issue again when i moved from one machine to another and had everything reinstalled. In my case, i'm using both 32bit and 64bit Oracle ODP.NET installs.

在我的新机器上列出程序集时,我最终得到以下列表

When listing the assemblies on my new machine i ended up with the following list

 C:\oracle\product\11.2.0\X64\odp.net\bin\4>gacutil /l|findstr Oracle.DataAccess
     Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
     Policy.2.102.Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
     Policy.2.111.Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
     Policy.2.112.Oracle.DataAccess, Version=2.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
     Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64
     Policy.4.112.Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64

这里只能看到64位DLL。

only 64bit DLLs to be seen here.

我无法从web.config看到它,但我使用的是32位版本。

I couldn't see it from the web.config but the one i was using was a 32bit version.

当用GACutil检查我的旧机器时,我看到更多的DLL,也是X86的。

When checking my old machine with the GACutil, i saw more DLLs, also the X86 ones.

通过重新应用注册过程(这里引用的x32 / x64版本)修复了

Fixed by reapplying the registration process(both x32/x64 version referenced here)

OraProvCfg.exe /action:gac /providerpath:C:\oracle\product\11.2.0\x32\ODP.NET\bin\4\Oracle.DataAccess.dll

OraProvCfg.exe /action:gac /providerpath:C:\oracle\product\11.2.0\x64\ODP.NET\bin\4\Oracle.DataAccess.dll

之后,Visual Studio是一个快乐的兔子,并为我再次编译了所有内容。

after that , Visual Studio was a happy bunny and compiled everything again for me.

这篇关于无法加载文件或程序集“Oracle.DataAccess”或其中一个依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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