从 WIX 启用 UAC 的 Win 7 上卸载时停止服务
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,“文件正在使用”检测为时过早。查看有关其交互的 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
在对此进行更多研究后,解决方案是使用卸载程序(例如 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]