我正在更改配置文件中的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.
我在這種情況下,手動啓動服務,不像安裝者應該能夠自行啓動服務的理想情況。此外,這是全新的安裝,我遇到此錯誤,而不是升級。
嘗試「NT AUTHORITY \ NetworkService」也許AUTHORITY是所有大小寫都有區別。從這裏https://msdn.microsoft.com/en-us/library/windows/desktop/ms684272%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396「帳戶的名稱必須是NT AUTHORITY \ NetworkService「從這個問題第二回答https://stackoverflow.com/questions/1606361/wix-serviceinstall-setting-the-service-to-run-under-the-networkservice-account –
您ServiceInstall和ServiceControl引用SCService1與顯示名稱xyz。該消息是指「Service」和「ServiceSvc」,那麼你是否更改了名稱?還是有另一種服務,你試圖啓動? – PhilDW
@PhilDW是的,我改變了名字,都是指同一個服務。更改它們時出錯! – Atihska