0

I have a Kofax component exe which I want to run as a service. Earlier srvany.exe is used to register the exe as a service manually. I am creating a wix msi installer which will install it as a service. After installation when I am running exe as a administrator manually then it is running perfectly and doing proper updates otherwise without admin giving some activex error. Therefore I checked "Run this program as a administrator" in exe property. My problem is the service installed by msi is not executing the exe automatically and no update happening. But if service is up and running and then I will try to run exe manually then it is giving message that "it is already running" that means service is running exe but not updating anythiing. What change should i make in below code so that service can pick the exe and run.

<Component Id="comp_KofaxCaptureQCRoute_exe" Guid="F7C1EBE7-3D7B-4E6D-8098-81EDDFD156EF" Permanent="no" Transitive="no">
            <File Id="file_KofaxCaptureQCRoute_exe" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="KofaxCaptureQCRoute.exe" Source="..\QC Route\KofaxCaptureQCRoute\bin\debug\KofaxCaptureQCRoute.exe" KeyPath="yes" />
        </Component>
        <Component Id="comp_file_srvany" Guid="D9CA373B-66B9-4FC5-A88D-E97FDDBBD526">
          <File Id="file_srvany" Source="..\QC Route\srvany.exe" KeyPath="yes" />

        <ServiceInstall 
        Id="QCRouteService"
        Type="ownProcess"
        Name="QCRouteService"
        DisplayName="Kofax_QCRoute_Service"
        Start="auto"
        Account="[SERVICEACCOUNT]"
        Password="[SERVICEPASSWORD]"
        ErrorControl="normal"
        Vital="yes"
         />
        <ServiceControl Id="Kofax_QCRoute_Service" Stop="both" Remove="uninstall" Name="QCRouteService" Wait="yes" />
        <RegistryKey Root="HKLM"
                 Key="SYSTEM\CurrentControlSet\Services\QCRouteService\Parameters"
          Action="createAndRemoveOnUninstall">
              <RegistryValue Type="string" Name="Application" Value="&quot;[#file_KofaxCaptureQCRoute_exe]&quot;"  />                 
        </RegistryKey>
          <RegistryKey Root="HKLM"
                 Key="SYSTEM\CurrentControlSet\Services\QCRouteService\Enum"
          Action="createAndRemoveOnUninstall">
              <RegistryValue Type="string" Name="0" Value="Root\LEGACY_QCROUTESERVICE\0000"  />
              <RegistryValue Type="integer" Name="Count" Value="1" />
              <RegistryValue Type="integer" Name="NextInstance" Value="1" />
          </RegistryKey>
      </Component>
Anurag
  • 57
  • 2
  • 13

1 Answers1

0

I believe in your service install you're trying to run it under the account specified by the properties SERVICEACCOUNT, SERVICEPASSWORD possibly taken from an example seen elsewhere.

If you don't have these properties set then you should use a ServiceInstall close to this one

<ServiceInstall 
    Id="QCRouteService"
    Type="ownProcess"
    Name="QCRouteService"
    DisplayName="Kofax_QCRoute_Service"
    Start="auto"
    Account="LocalSystem"
    ErrorControl="normal"
    Vital="yes"/>

Also note your ServiceControl has omitted the Start inner text

<ServiceControl Id="Kofax_QCRoute_Service" Start="install" Stop="both" Remove="uninstall" Name="QCRouteService" Wait="yes" />
Brian Sutherland
  • 4,698
  • 14
  • 16
  • I tried this but still no success. Do I need to include custom action tag? I am not aware about this. Also what actually Enum registry key does. I think I should remove this. What other things I can try? please suggest. – Anurag Aug 30 '16 at 03:07
  • I analyzed further and see that a dll is not invoked properly DBLite.dll and throwing below error Creating an instance of the COM component with CLSID {C49DF797-F12D-11D3-A41D-009027253C28} from the IClassFactory failed due to the following error: 80171500 Exception from HRESULT: 0x80171500. 08/30/2016 02:28:07: Object reference not set to an instance of an object. DO I need to register this dll by heat.exe? Also I have many other dll's like this. What should I do. – Anurag Aug 30 '16 at 07:55
  • If you aren't changing interfaces a lot (shouldn't happen anyways) then yes you can use heat to harvest the registry info. There are two things you can do, harvest *every* build which would automatically get changes or only harvest once and maintain the wxs components after the initial work getting the reg stuff in there. I took the 2nd approach with my installers. – Brian Sutherland Aug 30 '16 at 14:01
  • A 3rd option is to specify `SelfRegCost="1"` in your files to call regsvr32 on them during install but this is not very recommended by the WiX community since you don't have control over what happens in DllRegisterServer and DllUnregisterServer. – Brian Sutherland Aug 30 '16 at 14:04