我遇到了问题,卸载(或升级)时,重新启动管理器抱怨文件正在使用中,因此强制重新启动:
RESTART MANAGER: Detected that application with id 7000, friendly name 'javaw.exe', of type RmCritical and status 1 holds file[s] in use.
RESTART MANAGER: Did detect that a critical application holds file[s] in use, so a reboot will be necessary.
RESTART MANAGER 抱怨的服务是基于 java 的服务。该服务(这里称为 myservice.exe)递归地启动 java 子进程:
myservice.exe --run
↳ javaw.exe --someArguments
↳ someother.exe --someArguments
↳ javaw.exe --someMoreArguments
服务定义的 wix 片段:
<DirectoryRef Id="BINDIR">
<Component Id="myservice.exe" Guid="PUT-GUID-HERE">
<File Id="myservice.exe" KeyPath="yes" Vital="yes"
Source="SourceDir\bin\myservice.exe"/>
<ServiceInstall Id="MyService" Type="ownProcess"
Vital="yes" Name="MyService" DisplayName="My Service"
Description="My Service" Start="auto" Account=".\LocalSystem"
ErrorControl="normal" Interactive="no" Arguments="--run"/>
<ServiceControl Id="MyService" Name="MyService" Wait="yes" Remove="uninstall" Stop="uninstall" Start="install"/>
</Component>
</DirectoryRef>
现在,有趣的部分:
- 该服务可以在安装时启动
卸载时:
- 如果不运行,它将被删除
- 如果正在运行,并且只是同意重新启动
- 它确实在大约 2-3 秒内停止(我猜是通过 StopServices 操作)
- 并成功删除(通过 RemoveServices 操作)
到目前为止,Service* Tables 中的条目对我来说似乎很好。
ServiceControl-Table:
ServiceControl Name Event Arguments Wait Component_
MyService MyService 161 1 myservice.exe
ServiceInstall-Table:
ServiceInstall Name DisplayName ServiceType StartType ErrorControl LoadOrderGroup Dependencies StartName Password Arguments Component_ Description
MyService MyService My Service 16 2 32769 .\LocalSystem --run myservice.exe My Service
因此,分解所有内容:
似乎重新启动管理器没有识别出 java 进程是子进程并且将被 StopServices 操作停止。
我在这里发现了一些类似的问题:
https
://www.mail-archive.com/wix-users@lists.sourceforge.net/msg57924.html Wix 安装程序问题:为什么 RestartManager 将服务标记为 RMCritical 而不是 RMService
提前感谢您为解决此问题提供的任何帮助!