Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.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
如何使用WiX在NetworkService帐户下安装和启动Windows服务?_Windows_Installation_Service_Wix - Fatal编程技术网

如何使用WiX在NetworkService帐户下安装和启动Windows服务?

如何使用WiX在NetworkService帐户下安装和启动Windows服务?,windows,installation,service,wix,Windows,Installation,Service,Wix,我正在尝试创建一个wix安装程序来安装和启动NetworkService帐户下的Windows服务,但失败了,我得到的是无法安装“服务”()。验证您是否有足够的权限安装系统服务。“ 请注意,我的代码如下: <Component Id="service" Guid='myguid'> <File Id='JobServiceEXE' Name='JobService.exe' DiskId='1' Source='mypath\JobService.exe'

我正在尝试创建一个wix安装程序来安装和启动NetworkService帐户下的Windows服务,但失败了,我得到的是无法安装“服务”()。验证您是否有足够的权限安装系统服务。“

请注意,我的代码如下:

<Component Id="service" Guid='myguid'>
          <File Id='JobServiceEXE' Name='JobService.exe' DiskId='1' Source='mypath\JobService.exe' KeyPath='yes' />
          <ServiceControl Id="JobService" Name="[SERVICEID]" Stop="uninstall" Remove="uninstall" Wait="yes" />
          <ServiceInstall
          Id="JobService" Name="[SERVICEID]" DisplayName="[SERVICENAME]" Type="ownProcess"  Start="auto" ErrorControl="normal" Vital ='yes'
          Account="NT Authority\NetworkService"
          Description="Job Service" />
        </Component>


谢谢!

首先,您收到的消息可能是由于安全问题。您的安装程序必须由管理员运行,因为创建服务需要管理权限。您可以在
条件
元素中进行检查


第二,在非英语系统上使用
NT Authority\NetworkService
作为帐户名将失败,因为内置帐户名是本地化的。相反,请使用Wix专门识别并解析为正确本地化名称的普通旧
NetworkService

Paul的回答不正确。根据MSDN文档n、 要指定网络服务帐户,请使用“NT授权\网络服务”:

…帐户的名称必须为

NT授权\网络服务

调用CreateService或ChangeServiceConfig时,无论语言环境如何

设置属性“ALLUSERS”以强制管理员安装


有关更多信息,请参阅链接

我一直在Windows 7上安装此软件,它困扰了我很多年。我通过添加

InstallScope="perMachine"
到我的包元素:

<Package Description="..."
         Manufacturer="Microsoft Corporation"
         InstallerVersion="200"
         Languages="1033"
         Compressed="yes"
         InstallScope="perMachine"/>

感谢您的回复,您能告诉我如何检查条件元素中的安全问题吗?我对wix非常陌生。我刚刚将帐户名更改为NetworkService,但结果仍然相同。谢谢。