wix 服务无法启动,但如果我手动启动,它可以工作
我正在使用 wix 编写安装程序。作为安装的一部分,我正在安装一项服务并启动它。但我无法启动该服务。
这是wix代码:
<Component Id="Service" Guid="*">
<File Id="MyService.exe"
Name="MyService.exe"
Source="MyService.exe"/>
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="MyService"
DisplayName="Name="MyService.exe"
Description="Name="MyService.exe"
Start="auto"
Account="LocalSystem"
ErrorControl="normal"
Interactive="no">
<ServiceDependency Id="CcmExec"/>
</ServiceInstall>
<ServiceControl Id="ServiceController"
Start="install"
Stop="both"
Remove="uninstall"
Name="MyService"
Wait="no"/>
</Component>
</DirectoryRef>
在查看msi详细日志后,它显示错误1920
但是如果我手动安装服务(在cmd提示符下使用MyService -service)并使用Services.msc启动它,它工作正常。之后,我的安装程序能够卸载,并在重新安装后再次能够启动服务,没有任何问题。
I am writing an installer using wix. As part of installation, i am installing a service and starting it. But I am unable to start the service.
This is the wix code:
<Component Id="Service" Guid="*">
<File Id="MyService.exe"
Name="MyService.exe"
Source="MyService.exe"/>
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="MyService"
DisplayName="Name="MyService.exe"
Description="Name="MyService.exe"
Start="auto"
Account="LocalSystem"
ErrorControl="normal"
Interactive="no">
<ServiceDependency Id="CcmExec"/>
</ServiceInstall>
<ServiceControl Id="ServiceController"
Start="install"
Stop="both"
Remove="uninstall"
Name="MyService"
Wait="no"/>
</Component>
</DirectoryRef>
After going through the msi verbose logs it says error 1920
But if I install the service manually (using MyService -service from cmd prompt) and start it using Services.msc, it works fine. After that my installer is able to uninstall and again upon reinstalling able to start the service without any issues.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ServiceControl 元素的 Name 属性与 ServiceInstall 元素的 Name 属性不匹配。您正在创建一个名为“MyService”的服务,但尝试启动一个名为“MyService.exe”的服务。该服务不存在,因此您得到 1920。
另外一个次要原因可能是您的服务 exe 具有 COM 元数据,而您尚未将其编写到 wxs 中。
The Name attribute of your ServiceControl element isn't matching the Name attribute of your ServiceInstall element. You are creating a service called "MyService" but trying to start a service named "MyService.exe". This service doesn't exist so you get a 1920.
Also a secondary cause could be that your service exe has COM metadata and you haven't authored this into the wxs.