Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows services WiX Windows服务赢得';当帐户不是LocalSystem时,无法启动_Windows Services_Wix3.11 - Fatal编程技术网

Windows services WiX Windows服务赢得';当帐户不是LocalSystem时,无法启动

Windows services WiX Windows服务赢得';当帐户不是LocalSystem时,无法启动,windows-services,wix3.11,Windows Services,Wix3.11,将安装程序应用程序转换为WiX时,我遇到了以下现象,即使用C#编写的Windows服务应用程序: 1.)配置带有ServiceInstall部分assign Account=“LocalSystem”的主EXE组件时,应用程序将成功安装,但不会运行(-start)。它没有对将连接到的数据库的身份验证,因此也就不足为奇了 2.)使用项目1中的安装,我将ValidAccount和ValidPassword应用于服务属性的“登录”选项卡。如预期的那样,手动完成后,服务将启动并成功运行 3.)回到Wix

将安装程序应用程序转换为WiX时,我遇到了以下现象,即使用C#编写的Windows服务应用程序:

1.)配置带有ServiceInstall部分assign Account=“LocalSystem”的主EXE组件时,应用程序将成功安装,但不会运行(-start)。它没有对将连接到的数据库的身份验证,因此也就不足为奇了

2.)使用项目1中的安装,我将ValidAccount和ValidPassword应用于服务属性的“登录”选项卡。如预期的那样,手动完成后,服务将启动并成功运行

3.)回到Wix项目,我将前面提到的ServiceInstall部分更改为与步骤2中使用的Account=“ValidAccount”Password=“ValidPassword”相同,并重建MSI文件。安装失败,在ServiceInstall之后出现以下日志消息:

InstallServices: Service: 
    Error 1923. Service 'My Service' (MyService.exe) could not be installed. Verify that you have sufficient privileges to install system services.
    MSI (s) (B4:30) [12:54:38:616]: I/O on thread 20432 could not be cancelled. Error: 1168
    MSI (s) (B4:30) [12:54:38:616]: I/O on thread 13032 could not be cancelled. Error: 1168
    MSI (s) (B4:30) [12:54:38:616]: I/O on thread 10548 could not be cancelled. Error: 1168
    MSI (s) (B4:30) [12:54:38:616]: I/O on thread 19688 could not be cancelled. Error: 1168
    MSI (s) (B4:30) [12:54:38:616]: I/O on thread 6588 could not be cancelled. Error: 1168
    MSI (s) (B4:30) [12:54:38:616]: I/O on thread 10132 could not be cancelled. Error: 1168
    MSI (s) (B4:94) [12:54:38:616]: Product: MyService -- Error 1923. Service 'My Service' (MyService.exe) could not be installed. Verify that you have sufficient privileges to install system services.
4.)我已确认ValidAccount是本地管理员组的成员

5.)我已确认ValidAccount已添加到“作为服务登录”策略中

6.)我在服务中没有GAC依赖项(有人指出GAC依赖项是在最后添加的,可能会中断安装。)

我错过了什么。。。即使是使用LocalSystem的不做任何事情的服务也可以。但是,如果我按如下所示设置帐户和密码,它将不会安装

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="TestService.exe" Guid="196BB5E5-F157-4CA2-B740-0A68E1539B7C">
        <File 
          Id="TestService.exe" 
          Source="$(var.TestService.TargetPath)" 
          KeyPath="yes" />
    
        <ServiceInstall 
          Id="TestService.exe" 
          Name="TestService.exe" 
          DisplayName="Test Service"
          Description="This is a test service to test installation with WiX."
          Account="myDomain\myAccount" <!-- using myAccount without the domain yields same failure -->
          Password="myAccountPassword"
          Arguments="-start" 
          Start="auto" 
          Interactive="yes" 
          Type="ownProcess" 
          Vital="yes" 
          ErrorControl="ignore" />

        <ServiceControl 
          Id="TestService.exe" 
          Name="TestService.exe" 
          Stop="both" 
          Start="install" 
          Remove="uninstall" 
          Wait="no" />
      </Component>
    </ComponentGroup>
  </Fragment>


经过一系列的实验,我找到了答案。实际上,这似乎是WiX工具集(3.11.2版)中的一个bug,但我不确定是否有人是故意这么做的。向ServiceInstall添加密码时,Interactive属性必须设置为“否”

由于某些未知原因,如果将其设置为“是”,则仅安装不需要密码的帐户

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <Component Id="TestService.exe" Guid="196BB5E5-F157-4CA2-B740-0A68E1539B7C">
        <File 
          Id="TestService.exe" 
          Source="$(var.TestService.TargetPath)" 
          KeyPath="yes" />
    
        <ServiceInstall 
          Id="TestService.exe" 
          Name="TestService.exe" 
          DisplayName="Test Service"
          Description="This is a test service to test installation with WiX."
          Account="myDomain\myAccount" <!-- using myAccount without the domain yields same failure -->
          Password="myAccountPassword"
          Arguments="-start" 
          Start="auto" 
          Interactive="no" <!-- MUST BE NO WHEN PASSWORD IS USED -->
          Type="ownProcess" 
          Vital="yes" 
          ErrorControl="ignore" />

        <ServiceControl 
          Id="TestService.exe" 
          Name="TestService.exe" 
          Stop="both" 
          Start="install" 
          Remove="uninstall" 
          Wait="no" />
      </Component>
    </ComponentGroup>
  </Fragment>

Type=“ownProcess”
Vital=“是”
ErrorControl=“忽略”/>
祝你一切顺利,
肯特

这是最有可能的答案。关于实际安装权限、作为服务登录和缺少依赖项的其他答案可能会有所帮助,但它们可能是解决此问题的少数答案。