试图用不正确的格式错误加载程序 [英] An attempt was made to load a program with an incorrect format ERROR

查看:189
本文介绍了试图用不正确的格式错误加载程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创造一个功能由一个64位的DLL执行的Web服务。当我尝试建立这个服务,我得到错误试图使用不正确的格式加载程序。 但是,当我运行一个32位的DLL,它工作正常。

I am trying to create a webservice where the functions are performed by a 64 bit DLL. When I try to build this service i get the error "An attempt was made to load a program with an incorrect format." But when I run a 32 bit DLL it works fine.

我想在一个Visual Studio 2012在C#.NET 4框架

I am trying to run in a visual studio 2012 on .net 4 framework in C#

我试图改变在IIS应用程序池的设置和更改搭建平台的目标任何CPU。无法查明问题的来源。请提供您的帮助。谢谢

I have tried changing the app pool settings in IIS and changed build platform target to any cpu. Cannot identify where the problem is coming from. Please provide you assistance. Thank you

推荐答案

右键点击你正在使用的应用程序池,然后转到高级设置。在(一般)有一个叫启用32位应用程序设置。如果你在64位操作系统上运行,这是设置为然后应用程序池将是一个32位的过程,因此,你的64位的DLL将不会加载。将其设置为来使你的应用程序池一个64位的过程。

Right click on the application pool you are using and go to Advanced Settings. Under (General) there is a setting called Enable 32-Bit Applications. If you're running on a 64 bit OS and this is set to true then the app-pool will be a 32bit process, and therefore your 64bit DLL won't load. Set it to false to make your app-pool a 64bit process.

此外,还要检查你正在构建为64位的DLL的依赖关系。它可以使用一个32位的DLL /组件。如果你有任何 [的DllImport] 属性在code,那么看看它们指的是.dll文件,并确保他们是64位兼容。

Also, check the dependencies of the DLL you're building as 64bit. It may be using a 32bit dll/assembly. If you've got any [DllImport] attributes in your code then look at the .dlls they refer to and ensure they're 64bit compatible.

这篇关于试图用不正确的格式错误加载程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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