An attempt was made to load a program with an incorrect format” even when the platforms are the same

本文介绍了解决在IIS7中运行32位应用、配置错误导致的执行问题及发布dll后无法正常使用的解决方案。包括修改IIS7设置启用32位应用、修复配置管理中的Build选项和调整线程池Identity设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下面我说下这个错误的几种解决办法。如果前2个方法还不能解决你的问题。那么请试下第三条。

1.If you try to run 32-bit applications on IIS7 (and/or 64-bit OS machine) you will get the same error. So, from the IIS7 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. 

2. Somehow, the Build checkbox in the Configuration Manager had been unchecked for my executable, so it was still running with the old Any CPU build. After I fixed that, Visual Studio complained that it couldn't debug the assembly, but that was fixed with a restart.

具体请参考: stackoverflow

3. 如果你当前的应用程序在debug模式下可以正常使用,但是你一但publish你的这些dll。他们将不能正常使用,即使你把所有文件都拷贝到指定的虚拟目录。这个时候你需要考虑下你的线程池的配置。尤其是Indentiy的设置。可以尝试用Networkservice。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值