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

Rup*_*ish 21 wix

即使重新启动,即使可执行文件消失,该服务仍然存在.我使用的是WIX 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>
Run Code Online (Sandbox Code Playgroud)

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

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.
Run Code Online (Sandbox Code Playgroud)

任何帮助将非常感激.

Mar*_*tin 14

我有一个几乎相同的安装程序,工作正常.唯一的区别是我的ServiceControl元素与ServiceInstall元素具有不同的Id,以及'Start ="install"'属性.

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

请尝试以下方法:

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

  • 关.问题不是ID而是Component/@Guid.一旦我改变了,卸载工作正常.在创建新版本的产品时,服务组件的Guid显然需要与Product/@ Id一起更改. (5认同)
  • 那不是真的。更改 Component/@Guid 意味着组件中包含的所有资源也必须更改。这是一种 MSI 限制,通常称为“组件规则”。更改 Component/@Guids 时,您会看到非常奇怪的升级和卸载行为。原始卸载的详细日志文件应显示 ServiceControl 未删除您的服务的原因。 (2认同)

Jaz*_*zon 12

我也有类似的问题.就我而言,我只需要确保ServiceInstall和ServiceControl的"Name"属性都相同,问题就消失了.


小智 5

我有同样的问题,服务未删除。我从另一个项目复制了组件、服务安装和服务控制元素,但没有更改 Guid 或 ID。使用新的 GUID 和 ID 更新后,服务现在将删除。