Service component
<Component Id="cmp1" Guid="{guid1}">
<File Id="fil1" KeyPath="yes" Source="$(var.SourceDir)\Service1.exe" />
<ServiceInstall Id="ServiceInstall1"
Type="ownProcess"
Name="SCService1"
DisplayName="xyz"
Description="abc"
Start="auto"
Account="NT Authority\NetworkService"
ErrorControl="normal"
Vital="yes" >
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="none" ResetPeriodInDays="1" />
<ServiceConfig DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes" />
</ServiceInstall>
<ServiceControl Id="ServiceControl1" Name="SCService1" Start="install" Stop="uninstall" Remove="uninstall" Wait="no" />
Config Component
<Component Id="cmp2" Guid="{guid2}">
<File Id="fil2" KeyPath="yes" Source="$(var.SourceDir)\Service1.exe.config"/>
</Component>
<!--XML config file upgrade change-->
<Component Id="ServiceConfigUpgrades" Guid="{guid3}">
<Condition><![CDATA[(INSTALLDIR <> "") AND NOT REMOVE]]></Condition>
<CreateFolder />
<util:XmlFile Id="UpdateServiceVersion"
File="[#fil2]"
Action="setValue"
Name="sku"
Value=".NETFramework,Version=v4.6.2"
ElementPath="configuration/startup/supportedRuntime" />
</Component>
我在日志中收到以下错误消息:
Error 1920. Service 'Service' (ServiceSvc) failed to start. Verify that you have sufficient privileges to start system services.
MSI (s) (B4:18) [14:59:16:380]: Product: XYZ -- Error 1920. Service 'Service' (ServiceSvc) failed to start. Verify that you have sufficient privileges to start system services.
在这种情况下,我必须手动启动服务,这与安装程序应该能够自己启动服务的理想情况不同。此外,这是一个新安装,我遇到了这个错误,而不是在升级。