Сервис Worker не запускается при установке msi с помощью Wix - PullRequest
0 голосов
/ 11 июля 2020

Я создал для службы worker в. net core 3.1. Также создал msi с помощью набора инструментов wix. Мне нужно запустить службу автоматически при установке msi.

То, что я пробовал

Product.wxs

<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes"
    Name="MyWorkerServiceWix" DisplayName="MyWorkerServiceWix"
    Description="Example Windows Service" Start="auto"
    Account="LocalSystem" ErrorControl="normal"
    Arguments=" /start MyWorkerServiceWix"
    Interactive="no" />

 <ServiceControl Id="StartService"  Stop="both" Start="install" Remove="uninstall"   Name="MyWorkerServiceWix" Wait="yes" /> 

Но отображается ошибка

"Service 'MyWorkerService' failed to start.Verify that you have sufficient privileges to start system services."

Таким образом, эта проблема решена путем изменения ServiceController на две части следующим образом:

 <ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes"
        Name="MyWorkerServiceWix" DisplayName="MyWorkerServiceWix"
        Description="Example Windows Service" Start="auto"
        Account="LocalSystem" ErrorControl="normal"
        Arguments=" /start MyWorkerServiceWix"
        Interactive="no" />

   
  <ServiceControl Id="StartService" Name="Dhcp" Start="install"  Wait="yes" />
  <ServiceControl Id="StopService" Name="Dhcp" Stop="uninstall" Remove="uninstall" Wait="yes" /> 

Теперь рабочая служба успешно устанавливается, но не находится в рабочем состоянии при установке.

...