Unhandled Exception: System.BadImageFormatException: Could not load file or assembly (2008R2配置x64website)
2014-05-29 18:43
627 查看
.NET Error Message: Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'ChilkatDotNet2, Version=7.7.5.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' or one of its dependencies. An attempt was made to load a program with an incorrect format. File name: 'ChilkatDotNet2, Version=7.7.5.0, Culture=neutral, PublicKeyToken=eb5fc1fc52ef09bd' at MailBounce.Program.Main(String[] args)
Solution:Your program is trying to use a DLL targeted for win32 on an x64 platform, or the reverse: you have an x64 DLL and are trying to run it on a win32 computer.C# dll is built for 'Any CPU' platform by default. On 64 bit machine 'Any CPU' maps to 64 bit platform. Now when I run such a C# project which has been built for 'Any CPU' platform and refers a 32bit dll, BadImageFormatException is thrown because loader tries to load a 32 bit dll in 64 bit process address apace which is obviously going to fail.
so you either need to run it in a 32-bit OS or you have to make your application run inside WoW64. To force the app to run in WoW64 you can go to the project properties in VS, select the "build" tab, and set the "platform target" to x86.
//-------------------------------总结-------------------------
2008R2 website站点类型配置为 anycpu or x64
IIS7.5站点应用程序池 -〉高级设置-〉更改启用32位应用程序兼容,不建议使用
辨识64 or 32位运行通过任务管理器,w3wp.exe 后没有*32说明程序运行在64位池下,尽情享受高性能...
相关文章推荐
- Unhandled Exception: System.BadImageFormatException: Could not load file or assembly
- System.BadImageFormatException: Could not load file or assembly
- BadImageFormatException : Could not load file or assembly or one of its dependencies.
- Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Enterp
- VS2017调试Android出现"System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Posix, Ve
- SQLite 解决:Could not load file or assembly 'System.Data.SQLite ... 试图加载格式不正确的程序
- Could not load file or assembly 'App_Web_xxxx' or one of its dependencies. The system cannot find the file specified.
- Could not load file or assembly An attempt was made to load a program with an incorrect format.
- Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. The parameter is incorrect. (Exception
- Could not load file or assembly 'System.Web.Extensions, Version=3.5.0.0
- Could not load file or assembly'System.Data.SQLite.dll' or one of its depedencies
- [Exception] – Could not load file or assembly App_Web_*** ASP.NET
- .net framework 4.0 mvc 应用部署 System.Web.Mvc 错误 Could not load file or assembly 'System.Web.Mvc .
- [Exception] – Could not load file or assembly App_Web_*** ASP.NET
- Exception from HRESULT: 0x800736B1,Could not load file or assembly 'Microsoft.SqlServer.BatchParser
- Could not load file or assembly 'System.Web.Extensions解决方案
- .net framework 4.0 mvc 应用部署 System.Web.Mvc 错误 Could not load file or assembly 'System.Web.Mvc
- Could not load file or assembly ... An attempt was made to load a program with an incorrect format.
- MVC4 部署 could not load file or assembly system.web.http.webhost 或是其它文件出误
- Could not load file or assembly System.EnterpriseServices