util:CloseApplication 来自 Windows 服务

util:CloseApplication from Windows service

我正在尝试在更新我的应用程序期间关闭 "Tray Application"。从 "Windows Service" 关闭托盘的功能如下所示:

<util:CloseApplication 
  Id="CloseTrayAgent"
  Target="$(var.TrayAgentBinName).exe"
  RebootPrompt="no"
  CloseMessage="yes"
  Description="Tray application is still running"/>

<InstallExecuteSequence>
  <Custom Action="WixCloseApplications" Before="RemoveFiles" />
</InstallExecuteSequence>

如果从 "User"(仅从用户控制台)调用更新,则该方案有效,但如果从 "Windows Service" 调用,则该方案无效。 我检查了 msi 日志,但在我看来没有错误。

我的错误在哪里?谢谢

服务 运行 在会话零中,它与交互式桌面会话隔离。本文明确指出了使用 SendMessage 等 API 向交互式会话中的应用 运行ning 发送消息的服务的问题:

https://blogs.technet.microsoft.com/askperf/2007/04/27/application-compatibility-session-0-isolation/

搜索 -services session isolation- 或 -session 0- 将提供更多信息。