我正在尝试为我的C#项目安装一个服务安装的WiX安装程序。 这是我第一次尝试,我不明白为什么它不起作用。
我已经设置了一个ServiceInstall,但是当我运行安装程序时,我被阻止在这个页面中:
几秒钟后,我得到了错误:
我使用相同的参数从Visual Studio安装程序创build了WiX安装。 有这样的代码:
<Product ... /> <Feature Id="ProductFeature" Title="$(var.product)" Level="1"> <ComponentRef Id ="MyService"/> </Feature> <UIRef Id="WixUI_InstallDir"/> <!-- Set install directory --> <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"/> </Product> <Fragment> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLFOLDER" Name="$(var.product)"> <Component Id="MyService" Guid="{GUID-HERE}" KeyPath="yes"> <!-- service will need to be installed under Local Service --> <ServiceInstall Id="MyService" Type="ownProcess" Vital="yes" Name="MyService" DisplayName="Service" Description="" Start="auto" Account="NT AUTHORITY\LocalService" ErrorControl="normal"/> <ServiceControl Id="StartDDService" Name="MyService" Start="install" Wait="no" /> <ServiceControl Id="StopDDService" Name="MyService" Stop="both" Wait="yes" Remove="uninstall" /> </Component> </Directory> </Directory> </Fragment> <Fragment> <ComponentGroup Id="ProductComponents"> <Component Id="ProductComponent" Guid="{}" Directory="INSTALLFOLDER"> <File Id="MyService.exe" Source="$(var.MyService.TargetDir)\MyService.exe"/> </Component> </ComponentGroup> </Fragment>
“无法启动”错误可能是一个特权问题,但是这个消息只是一个默认消息,无论它是否有特权。
这些情况通常是服务本身或依赖关系:
没有安装缺少的依赖Dll(或依赖关系等)。 这包括.NET框架。
该服务取决于正在安装到GAC的程序集,并且在启动服务时实际上不会提交这些程序集,所以这是缺少依赖关系的特例。
“未能启动”基本上是服务中的启动代码没有完成。 OnStart代码崩溃可能会导致这种情况。 国际海事组织服务部门应始终提供跟踪,以追踪提供诊断的途径和重要价值。