[英]Unable to start Service with WiX Installer
我正在尝试为我的C#项目安装带有服务安装的WiX安装程序。 这是我第一次尝试,我不明白为什么它不起作用。
我已经设置了ServiceInstall,但是当我运行安装程序时,此页面被阻止了:
几秒钟后,我得到了错误:
我使用相同的参数从Visual Studio安装程序创建了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代码崩溃可能导致此问题。 IMO服务应始终具有跟踪功能,以跟踪路径和有效值以提供诊断信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.