1

I am getting the following error when running my installer a secondary PC, but it works when i run it on my development machine.

MSI (s) (90:2C) [16:22:35:704]: Executing op: ServiceInstall(Name=PCR2,DisplayName=Amusoft PC Remote 2,ImagePath="C:\Program Files\Amusoft\PC Remote 2\web\Amusoft.PCR.Server.exe",ServiceType=16,StartType=2,ErrorControl=32771,,Dependencies=[~],,StartName=LocalSystem,Password=**********,Description=Backend service required for PC Remote to interact with this computer,,)
InstallServices: Service: 
Error 1923. Service 'Amusoft PC Remote 2' (PCR2) could not be installed.  Verify that you have sufficient privileges to install system services.

This is my fragment for installing and starting the service

<Fragment>
    <Component Id="RegistrySetValues" Guid="CCA1011E-0C44-4111-9089-A4F5D49D3D51" Win64="yes" Directory="WEBFOLDER">
        <RegistryKey Root="HKLM" Key="SOFTWARE\Amusoft\PC Remote 2" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
            <RegistryValue
                Type="string"
                Name="InstallLocation"
                Value="[PRODUCTNAMEFOLDER]"/>
            <RegistryValue
                Type="string"
                Name="Version"
                Value="$(var.ProductVersion)"/>
        </RegistryKey>
    </Component>
    <Component Id='BackendServerExe' Guid='7B39D2A5-140F-452D-BAEC-0B965A15CCC9' Directory='WEBFOLDER'>

        <File Id='BackendServer' Name='Amusoft.PCR.Server.exe' Vital='yes' Source='$(var.SolutionDir)..\artifacts\msi\web\Amusoft.PCR.Server.exe' KeyPath='yes'/>

        <fire:FirewallException
            Name='Amusoft PC Remote 2 Server'
            Id='BackendServerFirewall'
            Port='[CUSTOM_PORT]'
            Protocol='tcp'
            Profile='all'
            Scope='localSubnet'
            IgnoreFailure='no'
            Description='Amusoft PC Remote 2 Server'/>

        <ServiceInstall Name='$(var.ServiceName)'
                        Type='ownProcess'
                        Start='auto'
                        Account="LocalSystem"
                        DisplayName="Amusoft PC Remote 2"
                        Id="PCR2.Install"
                        Description="Backend service required for PC Remote to interact with this computer"
                        Vital="yes" ErrorControl="critical">
                        <!-- Vital="yes" ErrorControl="critical"> -->
                        

            <util:ServiceConfig
                FirstFailureActionType="restart"
                SecondFailureActionType="restart"
                ThirdFailureActionType="none"
                ResetPeriodInDays="1"
                ServiceName="$(var.ServiceName)"
                RebootMessage="PC Remote 2 requires a reboot"
                RestartServiceDelayInSeconds="180"
            />
        </ServiceInstall>


        <!-- <ServiceControl Id="PCR2.Control.Start" -->
        <!--                 Name="$(var.ServiceName)" -->
        <!--                 Start="install" -->
        <!--                 Wait="no" /> -->

        <ServiceControl Id="PCR2.Control.Stop"
                        Name="$(var.ServiceName)"
                        Stop="uninstall"
                        Remove="uninstall"
                        Wait="yes" />

        <!-- <ServiceControl Id="PCR2.Control" -->
        <!--                 Name="$(var.ServiceName)" -->
        <!--                 Remove="both" -->
        <!--                 Start="install" -->
        <!--                 Stop="both"/> -->
    </Component>
</Fragment>

I looked at these questions, but that did not fix my issue

Is this related to strong name signing? I don't understand why it works on my dev machine, but fails on a secondary machine

Dbl
  • 5,634
  • 3
  • 41
  • 66
  • I only have time for some quick links: [Messy list of debugging resources](https://stackoverflow.com/questions/25004226/msi-vs-nuget-packages-which-are-is-better-for-continuous-delivery/25005864#25005864). Try searching for "service". And [a bunch of ideas here](https://stackoverflow.com/questions/49623588/windows-application-startup-error-exception-code-0xe0434352/49637913#49637913). Typically you lack a runtime if the service starts on your dev-computer and not on the test box, or you have included debugging binaries that depend on completely different runtime files than the release version? – Stein Åsmul Aug 11 '21 at 23:57
  • I would make sure to try to start the service manually on the test box and check for logged errors - also enable any extra logging available - of course. You have probably tried both already. Maybe also check for any security software on the other box: anti-virus and firewall etc... [Tools for dependency scanning your binaries](https://stackoverflow.com/a/51940598/129130) - to check for missing runtimes or resource files. [Service FAQ site](https://www.coretechnologies.com/WindowsServices/FAQ.html). – Stein Åsmul Aug 12 '21 at 00:03
  • I often just install likely missing runtimes directly and then do a test start of the service. For example: `.Net`, `.Net Core`, `Java`, `VC++ Runtime`, `MS-XML (legacy)`, etc... There are so many (also deprecated ones). [I forgot this debugging list](https://stackoverflow.com/a/53530377/129130) - might be the quicker one to read. – Stein Åsmul Aug 12 '21 at 00:06
  • interestingly enough part of my journey was doing everything manually from a deferred action, which is when i finally got evenlog messages (which i did not get before) telling me about the underlying issue being a missing runtime. msiexec logs / error messages contained no information about this at all sadly – Dbl Aug 12 '21 at 01:26
  • Glad you found it. Needless to say: what you describe is very common with services. Being able to enable verbose logging mode from the service itself to log to the Eventlog or even to a file could help? MSI can be cryptic Can we ask what runtime it was? Virtual machines tend to lack a lot of runtimes. – Stein Åsmul Aug 12 '21 at 09:58
  • dotnet 5 hosting runtime was missing. my dev machine has it through sdk of course, but i was under the apparently false impression that win10 rolled out net5 by default – Dbl Aug 12 '21 at 18:42
  • OK, I summarized in the answer below. Too many comments. – Stein Åsmul Aug 12 '21 at 19:55

1 Answers1

1

Solution: The .NET 5 hosting runtime was missing.


Lacking Runtime: Typically you lack a runtime if the service starts on your dev-computer and not on the test box. Common lacking runtimes: .Net, .Net Core, Java, VC++ Runtime, MS-XML (legacy), etc... Virtual machines often lack most runtimes in their base state, and this is a very common problem when testing setups.

Debug Binaries: Another variation of the above is to install debugging binaries that depend on completely different runtime files than the release version files. These debugging binaries are the binaries built when you use the "Debug" configuration in your Visual Studio project. They depend on dlls with "d" added to their file names (C++).


Other Ideas: There are many other potential causes. Here are some check lists for application and service launch failures:

Bitness: One should mention bitness as another "first issue" to check (x86 vs x64 binaries - incompatibilities and confusion).


Other Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164