卸载/升级时的Wix停止服务:防止“重启弹出”(文件在用情况)
我遇到了这个问题,在卸载(或升级)时,重启管理器抱怨文件处于使用状态,因此强制重启:
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 – 运行 服务定义的wix片段: <DirectoryRef Id="BINDIR"> <Component Id="myservice.exe" Guid="PUT-GUID-HERE"> <File Id="myservice.exe" KeyPath="yes" Vital="yes" Source="SourceDirbinmyservice.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动作) 到目前为止,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 所以,打破一切: 我在这里发现了一些类似的问题: 在此先感谢您解决此问题的任何帮助!
您有几个选项可以解决此问题:
-Disable“Restart Manager”,在属性表中使用MSIRESTARTMANAGERCONTROL =“Disable”.这将启动传统的“FilesInUse”对话框. 但是,这也意味着可能需要重新启动,不一定是因为您的服务,而是由于某些其他进程可能正在使用您的文件.如果您认为除了您自己的服务保留文件之外不会有其他进程,那么请继续并遵循此方法.如果您认为除了服务保存文件之外可能还有其他进程,那么启用“重新启动管理器”是理想的选择.没有“重新启动管理器”将导致以下任何一件事: – 显示Legacy FilesInUse对话框,要求您关闭对话框中列出的进程.这可能导致您必须通过自定义操作关闭这些进程. “InstallManager”和“FilesInUse”对话框都由“InstallValidate”标准操作显示.如果要禁止这两个对话框,请确保在“InstallValidate”标准操作之前安排自定义操作.这里有一个问题.在InstallValidate之前安排这样的自定义操作必须是立即模式自定义操作(在“IntsallFinalize”之前不能有延迟模式自定义操作).因此,如果您没有以管理员身份运行(例如在启用UAC的情况下),您可能没有必要的权限来关闭应用程序.因此,可能需要重新启动. – 您还可以使用WiX util扩展CloseApplication()函数关闭应用程序.评估您的场景并做适合您的事情. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows-server-2012 – Get-NetAdapter Powershell Cmdlet
- windows-server-2003 – 我必须为RDP客户端安装所有可能的打
- 关于Windows的Lua IDE和调试器的建议
- kendo-ui – 如何从窗口内容中关闭Kendo窗口?
- Windows TCP窗口缩放过早达到高原
- windows – 如何在Delphi中隐藏MDI子窗体?
- windows-server-2008 – 查找可执行文件将数据包发送到特定
- windows – netsh int ip reset到底重置了什么?
- windows – 为什么我不能关闭从maven插件嵌入的tomcat 7?
- 批处理文件 – 如何在批处理文件中拆分不带循环的字符串