从 WIX 启用 UAC 的 Win 7 上卸载时停止服务

发布于 2024-08-15 18:05:28 字数 649 浏览 2 评论 0原文

在 Win7 或 Vista 中从 WIX 启用 UAC 时,如何在卸载时停止我的服务? 当我在启用 UAC 的 Win7 或 Vista 中从控制面板卸载服务时,我总是收到“文件正在使用”消息。我怎样才能阻止它以免出现该消息? 我在 Wix 中有这段代码:

     <ServiceInstall Id='MyServiceInstall' DisplayName='OnPremises Gateway' Name='OPGatewayService'
  ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes' Account='NT AUTHORITY\NetworkService'   />
          <ServiceControl Id="StartOPGatewayServiceControl" Name="OPGatewayService" Wait="no" Start="install"  />
          <ServiceControl Id="StopOPGatewayServiceControl" Name="OPGatewayService" Stop="both" Wait="yes" Remove="uninstall"/>

谢谢, 阿德里安娜

How can i stop my service at uninstall in Win7 or Vista with UAC on from WIX?
When i uninstall my service from Control Panel in Win7 or Vista with UAC on I always get "File is in use message". How can i stop it so that message won't appear?
I have this code in Wix:

     <ServiceInstall Id='MyServiceInstall' DisplayName='OnPremises Gateway' Name='OPGatewayService'
  ErrorControl='normal' Start='auto' Type='ownProcess' Vital='yes' Account='NT AUTHORITY\NetworkService'   />
          <ServiceControl Id="StartOPGatewayServiceControl" Name="OPGatewayService" Wait="no" Start="install"  />
          <ServiceControl Id="StopOPGatewayServiceControl" Name="OPGatewayService" Stop="both" Wait="yes" Remove="uninstall"/>

Thank you,
Adriana

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

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

发布评论

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

评论(2

浅暮の光 2024-08-22 18:05:28

不幸的是,“文件正在使用”检测为时过早。查看有关其交互的 MSI SDK 文档:http:// /msdn.microsoft.com/en-us/library/aa372466(VS.85).aspx

Unfortunately, the "File in use" detection is early. Check out the MSI SDK documentation about their interaction: http://msdn.microsoft.com/en-us/library/aa372466(VS.85).aspx

梦屿孤独相伴 2024-08-22 18:05:28

在对此进行更多研究后,解决方案是使用卸载程序(例如 Uninstall.exe),该程序在执行任何暗示系统更改(例如停止服务)的操作之前需要用户具有管理员权限。并从该程序运行 MsiExec.exe /X[MsiProductId]

After investigating more about this, the solution is to use a program at uninstall (like Uninstall.exe) which requires admin rights from user before any actions that imply system changes (like stop service). And from that program run MsiExec.exe /X[MsiProductId]

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