安装服务时出现System.BadImageFormatException [英] System.BadImageFormatException when installing service
问题描述
当我尝试运行安装程序以设置服务时,出现以下异常情况:
I am getting below exception when I try to run installer to set up service:
# ./InstallUtil ../../../../Applications/GasPosApp/bin/Wrapper.exe -s ../../../
../Applications/GasPosApp/properties/DispenserViewerApplication.wrapper.conf
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:\Appl
ications\GasPosApp\bin\Wrapper.exe' or one of its dependencies. The module was e
xpected to contain an assembly manifest..
推荐答案
您必须使用正确版本的InstallUtil.如果您尝试安装32位服务(x86),请使用
You have to use the right version of the InstallUtil. If you are trying install a 32 bit service (x86), use
c:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
如果要安装64位服务(x64),请使用
and if you are installing a 64 bit service (x64), use
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe
请注意,最后指定的文件夹(v4.0.30319)可能与计算机不同.如果只有较旧版本的框架可用,则可以改用以下文件夹之一-v1.0.xxxx,v1.1.xxxx,v2.0.xxxxx,v3.0,v3.5.
Note, that the last specified folder (v4.0.30319) may differ a machine from machine. If you have only an older version of the framework available you can encounter one of the following folders instead - v1.0.xxxx, v1.1.xxxx, v2.0.xxxxx, v3.0, v3.5.
这篇关于安装服务时出现System.BadImageFormatException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!