更改配置文件后,服务无法自行启动,并在运行安装程序时出现权限错误
问题描述:
我正在更改配置文件中的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.
我在这种情况下,手动启动服务,不像安装者应该能够自行启动服务的理想情况。此外,这是全新的安装,我遇到此错误,而不是升级。
答
此问题已通过使用INSTALDIR而不是INSTALLDIR解决。我拼错了。
尝试“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