这个问题在这里已有答案:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\_PRODUKCIJA\D
ebug\DynamicHtmlTool.exe
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\_PRO
DUKCIJA\Debug\DynamicHtmlTool.exe' or one of its dependencies. An attempt was ma
de to load a program with an incorrect format..
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>
服务是x86编译,即使两台计算机都是x64,它可以在我的计算机上运行 . 在服务器哪里是win 2008我得到这个错误 .
我试试谷歌的解决方案但没有工作 .
喜欢写在这里我有x86项目http://www.davesquared.net/2008/12/systembadimageformatexception-on-64-bit.html
5 回答
您似乎正在使用该工具的64位版本来安装32位/ x86架构应用程序 . 在这里查找该工具的32位版本:
它应该安装你的32位应用程序就好了 .
尝试配置项目的设置,通常是由于x86 / x64架构问题:
如图所示,设置您的选择:
我发现了一个不同的解决方案 . 显然,我的IIS 7默认情况下在我的应用程序池中没有启用32位模式 .
要启用32位模式,请打开IIS并选择应用程序池 . 我的名字叫"ASP.NET v4.0" .
右键单击,转到"Advanced Settings"并将名为:"Enabled 32-bit Applications"的部分更改为true .
重新启动Web服务器,然后重试 .
我从这个博客参考中找到了修复:http://darrell.mozingo.net/2009/01/17/running-iis-7-in-32-bit-mode/
此外,您可以更改Visual Studio上的设置 . 在我的情况下,我去了
Tools > Options > Projects and Solutions > Web Projects
并检查了Use the 64 bit version of IIS Express for web sites and projects
- 这是在VS Pro 2015上 . 没有其他任何修复但是这个 .我使用正确的框架安装了相同的异常 .
我的解决方案是以管理员身份运行cmd ....然后它工作正常 .
我的原因不同我引用了一个Web服务,然后我收到了这条消息 .
然后我更改了我的目标 .Net Framework 4.0 to .Net Framework 2.0 并重新引用我的webservice . 经过几次改变问题解决了 . 没有错误工作正常 .
希望这可以帮助!