更改配置文件后,服​​务无法自行启动并在 运行 安装程序时出现权限错误

After changing config file, service fails to start on its own and gives privileges error while running the installer

我正在更改配置文件中的 xml 节点。在我这样做之后,该服务不会自动启动。

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.

在这种情况下,我必须手动启动服务,这与安装程序应该能够自行启动服务的理想情况不同。而且,这是全新安装,我遇到此错误而不是升级。

这个问题已通过使用 INSTALDIR 而不是 INSTALLDIR 得到解决。我拼错了。