0
votes

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.

1

1 Answers

6
votes

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.