Wix 安装程序问题:为什么 RestartManager 将服务标记为 RMCritical 而不是 RMService [英] Wix Installer Problem: Why does RestartManager mark Service as RMCritical and not RMService

查看:12
本文介绍了Wix 安装程序问题:为什么 RestartManager 将服务标记为 RMCritical 而不是 RMService的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图阻止我们的 wix 安装程序在卸载时提示用户重新启动.我们的服务设置为在卸载时被卸载和删除.对我们来说不幸的是,RestartManager 提示用户在 InstallValidate 操作期间需要重新启动.此操作发生在 StopServices 和 DeleteServices 操作之前.

I'm trying to prevent our wix installers from prompting the user for a reboot when uninstalling. Our services are set to be uninstalled and deleted on an uninstall. Unfortunately for us the RestartManager is prompting the user that a reboot will be required during the InstallValidate action. This action occurs well before the StopServices and DeleteServices actions.

查看日志,似乎RestartManager认为我们的服务是关键进程:

Checking the logs, it seems that the RestartManager thinks that our service is a critical process:

检测到应用程序的 ID 为 1234,友好名称为abc",服务短名称为xyz",类型为 RmCritical,状态 1 包含正在使用的文件."

"Detected the application with id 1234, friendly name 'abc', service short name 'xyz', of type RmCritical and status 1 holds files[s] in use."

服务在本地系统帐户下安装和运行.我不确定,但我认为如果 RestartManager 返回 RmService 而不是 RmCritical 那么它不会提示重新启动.

The services are installed and running under the local system account. I'm not sure but I think if RestartManager was returning RmService instead of RmCritical then it wouldnt be prompting for a reboot.

非常感谢任何帮助.

MSDN 指出,对于 RMCritical:由于无法关闭进程,因此需要重新启动系统才能完成安装.由于以下原因,无法关闭该进程.该过程可能是关键过程.当前用户可能没有关闭进程的权限.该进程可能属于启动 Restart Manager 的主安装程序.

MSDN states that for RMCritical: A system restart is required to complete the installation because a process cannot be shut down. The process cannot be shut down because of the following reasons. The process may be a critical process. The current user may not have permission to shut down the process. The process may belong to the primary installer that started the Restart Manager.

用户确实有权关闭服务,并且服务与 msiexec 没有任何关系,所以我只能假设我们的服务被认为是一个关键进程....但是为什么呢?

The user does have permission to shut down the services, and the services are not anything to do with msiexec so I can only assume that our service is thought to be a critical process.... but why?

推荐答案

您可以通过设置 MSI 属性 MSIRESTARTMANAGERCONTROL= 来抑制窗口的 RestartManager禁用"(请参阅​​此处的文档 - http://msdn.microsoft.com/en-us/library/windows/desktop/aa370377(v=vs.85).aspx).这种方法本身的唯一问题是,他们不会通过需要重新启动的对话框来提示用户,而是会看到文件正在使用对话框(并被要求关闭任何可能正在使用这些文件/服务的应用程序).此对话框在 InstallExecute Sequence 的 InstallValidate 标准操作期间显示.

You can suppress window's RestartManager by setting the MSI property MSIRESTARTMANAGERCONTROL= "Disable" (see documentation here - http://msdn.microsoft.com/en-us/library/windows/desktop/aa370377(v=vs.85).aspx). The only problem with this approach by itself is that instead of prompting users with a reboot-required dialog, they will see the file-in-use dialog (and be asked to shut down any applications that might be using those files/services). This dialog is displayed during the InstallValidate standard action of the InstallExecute Sequence.

如果您想巧妙地绕过这些对话框中的任何一个,您可以在 InstallValidate 之前安排一个自定义操作,在 RestartManager 有机会检查系统之前手动关闭所有正在运行的服务.这不遵循标准的 MSI 实践,因为通常您会将修改系统的自定义操作标记为延迟"操作,但 MSI 不允许在 InstallValidate 之前运行任何延迟操作.因此,您必须将操作标记为立即",但在代码中您将继续通过关闭服务来修改系统.这里的缺点是没有立即回滚操作,因此如果您的卸载/升级失败并进行回滚,您停止的服务将处于停止状态.好处是用户在卸载/升级期间永远不必看到任何其他对话框.

If you want a sneaky way around either of these dialogs you can schedule a custom action before InstallValidate that manually shuts down any running services before the RestartManager has a chance to inspect the system. This does not follow standard MSI practices because normally you would mark a custom action that modifies the system as a 'deferred' action, but MSI doesn't allow any deferred actions to run before InstallValidate. So, you would have to mark the action as 'immediate', but in the code you would go ahead and modify the system by shutting down the services. The drawback here is that there's no such thing as an immediate rollback action, so if your uninstall/upgrade fails and does a rollback the services you stopped will be left in a stopped state. The upside is that users never have to see any additional dialogs during their uninstall/upgrade.

这篇关于Wix 安装程序问题:为什么 RestartManager 将服务标记为 RMCritical 而不是 RMService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆