为什么我的服务在卸载时没有被删除?(WIX)

问题描述:

即使在重新启动后,服务仍然存在,即使可执行文件消失了.我使用的是 WIX 版本 3.0.5419.0

Even after a reboot, the service is still there, even though the executable file is gone. I'm using WIX version 3.0.5419.0

<Component Id="IdiomServer.exe" Guid="7a751e1e-5e9e-41d2-be60-dc905ab1ccad">
  <File Id="IdiomServer.exe" Source="$(var.IdiomServer.TargetDir)IdiomServer.exe" KeyPath="yes" />
  <ServiceInstall Id="IdiomServer_Service" Name="IdiomServer 4.0" Account="LocalSystem" Description="Idiom Repository Server" ErrorControl="normal" Start="auto" Type="ownProcess" Vital="yes" />
  <ServiceControl Id="IdiomServer_Service" Name="IdiomServer 4.0" Remove="uninstall" Stop="uninstall" Wait="yes" />
</Component>

安装 Windows 服务工作正常.卸载它似乎什么也没做.卸载日志文件的部分:

Installing the Windows Service works fine. Uninstalling it appears to do nothing. Section of the log file from the uninstall:

MSI (s) (D8:5C) [09:43:58:033]: Doing action: StopServices
MSI (s) (D8:5C) [09:43:58:033]: Note: 1: 2205 2:  3: ActionText 
Action start 9:43:58: StopServices.
Action ended 9:43:58: StopServices. Return value 1.
MSI (s) (D8:5C) [09:43:58:033]: Doing action: DeleteServices
MSI (s) (D8:5C) [09:43:58:033]: Note: 1: 2205 2:  3: ActionText 
Action start 9:43:58: DeleteServices.
Action ended 9:43:58: DeleteServices. Return value 1.

任何帮助将不胜感激.

我有一个几乎完全相同的安装程序,运行良好.唯一的区别是我的 ServiceControl 元素与 ServiceInstall 元素具有不同的 Id,并且还有一个 'Start="install"' 属性.

I have an almost identical installer that works fine. The only differences are that my ServiceControl element has a different Id to the ServiceInstall element, and a 'Start="install"' property too.

我怀疑您的问题是 ServiceControl 元素的 ID,或者您有一个流浪服务.

I suspect your problem is either the Id of the ServiceControl element, or you have a stray service hanging around.

尝试以下操作:

  • 将 ServiceControl Id 更改为IdiomServer_ServiceControl"
  • 将两个 Service 元素中的 Name 更改为Foobar"并检查 Foobar 服务是否已安装和卸载.如果可行,您可能只需要使用sc"命令手动删除杂散的 IdiomServer 条目.