无法加载文件或程序集“Oracle.DataAccess"或其依赖项之一

编程入门 行业动态 更新时间:2024-10-28 10:23:48
本文介绍了无法加载文件或程序集“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.

  • 用 32 位 oracle dll 替换了所有的 oracle dll,即 2.112.3.0
  • 我在 64 位机器上安装了 32 位客户端.操作系统为windows 7.

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

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

  • 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

    使用此语句在 GAC 上注册 32 位 dllgacutil/i %ORA_HOME4%odpin4Oracle.DataAccess.dll

    Register the 32 bit dll on GAC using this statement gacutil /i %ORA_HOME4%odpin4Oracle.DataAccess.dll

    gacutil/i %ORA_HOME4%aspin4oracle.web.dll

    gacutil /i %ORA_HOME4%aspin4oracle.web.dll

    对于上面两条语句,我从c:Program Files(x86)Microsoft sdkwindowsv7.0ABinNETFX4.0 ToolsX64复制了gacutil.exe到 C: 驱动器然后

    for the above two statements, I copied the gacutil.exe from c:Program Files(x86)Microsoft sdkwindowsv7.0ABinNETFX4.0 ToolsX64 to C: drive and then

    我执行了上面两条语句:

    I executed the above two statement:

    gacutil/i %ORA_HOME4%odpin4Oracle.DataAccess.dllgacutil/i %ORA_HOME4%aspin4oracle.web.dll执行上面两条语句时,没有收到任何消息,我是在管理员权限下在Dos windows中执行的.

    gacutil /i %ORA_HOME4%odpin4Oracle.DataAccess.dll gacutil /i %ORA_HOME4%aspin4oracle.web.dll when I executed the above two statements, I didn't get any message, I executed them in Dos windows under administrator privilege.

  • 我还删除了该位置的所有临时 ASP 文件
  • c:windowsMicrosoft.NetV4.0.30319临时 ASP 文件我还将 web 应用程序构建平台目标更改为 X86,最初是在任何 CPU".出于沮丧,我还尝试将平台目标更改为 X64,然后收到错误消息说

    c:windowsMicrosoft.NetV4.0.30319 emporary ASP 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

    "冷不加载文件或汇编.网络应用程序"或其依赖项之一.试图加载格式不正确的程序.

    " 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.

    推荐答案

    当我从一台机器移到另一台机器并重新安装所有东西时,问题再次出现.就我而言,我同时使用 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:oracleproduct11.2.0X64odpin4>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:oracleproduct11.2.0x32ODP.NETin4Oracle.DataAccess.dll OraProvCfg.exe /action:gac /providerpath:C:oracleproduct11.2.0x64ODP.NETin4Oracle.DataAccess.dll

    在那之后,Visual Studio 就像一只快乐的兔子,并为我重新编译了所有东西.

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

    更多推荐

    无法加载文件或程序集“Oracle.DataAccess"或其依赖项之一

    本文发布于:2023-11-03 06:18:17,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1554428.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:或其   加载   文件   程序   Oracle

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!