MSI:启动服务,除非用户选择重新启动计算机

发布于 2024-09-13 06:42:02 字数 256 浏览 0 评论 0原文

我正在开发 MSI 安装程序,用于安装并启动该服务。它可能会也可能不会替换正在使用的文件。当它出现时,安装结束时会提示重新启动计算机。

服务在首次启动时运行冗长的初始化,不希望因关闭而中断。我想做的是阻止服务启动,直到知道安装完成,并且不会重新启动,例如:不需要重新启动或用户选择推迟重新启动。

Bootstrapper 不是一个选项,所有内容都必须在 MSI 内实现

有人可以告诉我,执行此操作的最佳方法是什么?

I am working on MSI installer which installs and starts the service. It may or may not replace files in use. When it does, there is a prompt to reboot machine at the end of install.

Service runs lengthy initialization on the first startup, which is undesirable to interrupt by shutdown. What I am trying to do is to prevent service from starting until it is known that setup completed, and there will not be a reboot, e.g.: reboot not needed or user selected to postpone reboot.

Bootstrapper is not an option, all must be implemented inside an MSI

Can somebody advise me, what's the best way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我纯我任性 2024-09-20 06:42:02

我将给出一个务实但不完美的答案......Windows Installer 并没有任何方法来支持这一点,所以只是故意请求重新启动并且没有 ServiceControl 元素。只需将 ServiceInstall 设置为 Auto,然后让重新启动来处理其余的事情。

我知道,我通常也会尽量避免重新启动,但如果你经常需要重新启动,那么它只会让你的整个故事变得更简单。

我真正能想到的唯一的另一件事是在您的服务中公开一个 RPC 机制(例如 wcf 端点),并且让您的长时间运行的进程仅在服务的第二次启动或第一次调用该 RPC 时发生。时间。如果不需要重新启动,则可以在安装程序结束时执行自定义操作来调用 rpc。

我只是想不出任何方法可以在 MSI 中本地完成此操作。

I'm going to give a pragmatic although not perfect answer.... Windows Installer doesn't really have any way to support this so just intentionally request a reboot and don't have a ServiceControl element. Just set the ServiceInstall to Auto and let the reboot take care of the rest.

I know, I usually try to avoid reboots also but if you are frequently likely to need one anyways well it just makes your whole story simpler.

The only other thing I can really think of is to expose an RPC mechansim in your service ( wcf end point for example ) and have your long running process only take place on either the second start of the service or when that rpc is invoked the first time. Then have a custom action at the end of the installer call the rpc if a reboot is not required.

I just can't think of any way to do it natively in MSI.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文