无法加载文件或程序集xxx或其某个依赖项。(Could not load file or assembly xxx or one of its dependencies. An attempt was

编程入门 行业动态 更新时间:2024-10-26 22:22:32
无法加载文件或程序集xxx或其某个依赖项。(Could not load file or assembly xxx or one of its dependencies. An attempt was made to load a program with an incorrect format.)

当我在Windows Server 2012(IIS 8)上托管我的网站时,出现“无法加载文件或程序集xxx或其某个依赖项*********”错误。 这里的xxx是我的本地VS 2015中的项目名称。该应用程序在我的本地PC中运行得非常好

它是一个带有Oracle 12c数据库的VB.NET应用程序,因为它是后端。

我迄今为止尝试过的东西。 1.将目标CPU设置为“任何CPU”并将其配置为“释放任何CPU”发布 - 仍然是同样的错误。 2.在服务器IIS中,我将应用程序的应用程序池上的启用32 - 但应用程序设置为True。 这是一个不同的错误。 - 无法加载文件或程序集“Oracle.DataAccess”或其某个依赖项。 试图加载格式不正确的程序。

请帮忙。

I get the "Could not load file or assembly xxx or one of its dependencies*********" error when I host my website on a Windows Server 2012 (IIS 8). The xxx here is my project name in my local VS 2015. The application is working perfectly fine in my local PC

It is a VB.NET application with Oracle 12c database as it's backend.

Things I have tried till now. 1. Publish with setting the Target CPU as "Any CPU" and Configuration as "Release-Any CPU" - Still the same error. 2. In the Server IIS, I have set the Enable 32-but apps as True on App's App pool. This is giving a different 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.

Please help.

最满意答案

这听起来像你的Oracle.DataAccess DLL是一个64位的DLL。 您可以通过在Windows资源管理器中导航到\ windows \ assembly文件夹来查看Web服务器上加载的驱动程序。 在这里输入图像描述

大多数使用Any CPU选项构建的应用程序都会在项目设置中使用32位的复选框。 为避免这种情况,请将项目的平台目标更改为64位。

在这里输入图像描述

然后,您不需要在应用程序池中“启用32位”,并且问题应该消失。 请让我知道这可不可以帮你。

It sounds like your Oracle.DataAccess dll is a 64 bit dll. You can see what driver is loaded on the web server by navigating in Windows Explorer to the \windows\assembly folder. enter image description here

Most applications that are built with the Any CPU option will have the checkbox in the project settings to prefer 32 bit. To avoid this, change your project's platform target to be a 64 bit.

enter image description here

Then you do not need to "Enable 32 bit" in your application pool and your problem should disappear. Please let me know if this helps.

更多推荐

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

发布评论

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

>www.elefans.com

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