我有一个安装程序,用于安装窗口服务。启动和停止窗口服务的代码如下:
<Component Id="cmp690F4EBE95710C864C32A36852D2EB2F" Guid="{F933F79A-F76B-45F9-A951-6AD31C77B180}">
<File Id="fil61E48774FB18BBADEDCE4566002C9F54" KeyPath="yes" Source="$(var.APMrelease)\LiveServer.exe" Name="LiveServer.exe" DiskId="1">
<firewall:FirewallException Id="LiveServer.exe" Name="LiveServer.exe" Description="LiveServer 2.0" Profile="all" IgnoreFailure="yes" Scope="any" />
</File>
<ServiceInstall Id="InstallLiveServerService" DisplayName=" LiveServer" Description="LiveServer 2.0" Name="LiveServer" Start="auto" Type="ownProcess" Vital="yes" ErrorControl="normal">
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" ResetPeriodInDays="4" />
<!--<ServiceDependency Id="PostMaster" />-->
</ServiceInstall>
<ServiceControl Id="StopLiveServerService" Name="LiveServer" Stop="both" Remove="uninstall" Wait="yes" />
</Component>
我正在通过自定义操作开始服务,这很好。但是,在卸载安装程序时,有时服务会挂起,并且由于卸载失败而无法停止。有什么方法可以等待,然后终止服务或任何其他解决方法?