在 64 位系统上使用 32 位 dll 显示 0x8007000B 错误 [英] Using 32-bit dll on 64-bit system shows 0x8007000B Error
问题描述
我必须在我的应用程序中使用第三方 DLL.DLL 是 32 位的,我使用的系统是 64 位操作系统.
I have to use a third party DLL in my application. The DLL is a 32-bit and the system I am using is 64-bit OS.
我已经在我的 DotNet 应用程序 (framework-4.5) 中导入了 32 位 DLL,如下所示
I have Imported the 32-bit DLL in my DotNet application (framework-4.5) as below
[DllImport("Sample.dll",
EntryPoint = "Add",
CharSet = CharSet.Ansi,
CallingConvention = CallingConvention.StdCall)]
public static extern int Add(int iA, int iB);
在 IIS 7.5 中 - 我已将启用 32 位应用程序"设置为真".
In IIS 7.5 - I have set "Enable 32-bit Application" as "True".
并且还尝试将编译器管理器设置为 - X86、x64 和任何 CPU.
And also tried setting the Compiler Manager as - X86, x64 and Any CPU.
但是所有的尝试都会导致与
But all the attempt results in same Error as
An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
如何解决这个问题......
How to resolve this Issue......
推荐答案
如果您尝试在 IIS 7(和/或 64 位操作系统机器)上运行 32 位应用程序,您将遇到相同的错误.因此,在 IIS 7 中,右键单击应用程序的应用程序池并转到高级设置"并将启用 32 位应用程序"更改为TRUE".
If you try to run 32-bit applications on IIS 7 (and/or 64-bit OS machine), you will get the same error. So, from the IIS 7, right click on the applications' application pool and go to "advanced settings" and change "Enable 32-Bit Applications" to "TRUE".
重新启动您的网站,它应该可以工作了.
Restart your website and it should work.
这篇关于在 64 位系统上使用 32 位 dll 显示 0x8007000B 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!