没有足够的权限来安装服务

fre*_*ley 10 service windows-installer wix

我有以下服务声明:

<ServiceControl Id="ServiceStartStop"
                Name="[name]"
                Start="install"
                Stop="both"
                Remove="both"
                Wait="no"/>
<ServiceInstall Id="ServiceRegister"
                Name="[name]"
                DisplayName="[displayname]"
                Description="[description]"
                Account="LocalSystem"
                Arguments="-start"
                ErrorControl="critical"
                Interactive="yes"
                Start="auto"
                Type="ownProcess"
                Vital="yes" >
  <util:PermissionEx  User="Authenticated Users"
                      ServiceChangeConfig = "yes"
                      ServiceEnumerateDependents = "yes"
                      ServiceInterrogate = "yes"
                      ServicePauseContinue = "yes"
                      ServiceQueryConfig = "yes"
                      ServiceQueryStatus = "yes"
                      ServiceStart = "yes"
                      ServiceStop = "yes"
                      ServiceUserDefinedControl = "yes" />
</ServiceInstall>
Run Code Online (Sandbox Code Playgroud)

这编译和链接没有任何错误或警告.exe使用正确指定服务KeyPath="yes".当我运行我的msi时,它无法超越'Starting Service ...'.我收到一条错误消息,如下所示:

在此输入图像描述

单击"安装"时会显示UAC,那么出了什么问题?

Bry*_*anJ 12

它应该在没有WiX util扩展的情况下工作.这是我的完整测试安装程序.创建自己的测试项目,并将我的安装程序复制并复制到.wxs文件中.然后用您自己的服务替换File,ServiceInstall和ServiceControl路径和名称.如果您仍然收到相同的错误消息,那么您是否真的没有权限在您的计算机上进行安装?

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TestServiceInstaller" Language="1033" Version="1.0.0.0" Manufacturer="test" UpgradeCode="d2b63c57-ca50-4f6a-8019-e826cac3d788">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="TestServiceInstaller" Level="1">
        <ComponentGroupRef Id="ProductComponents" />
    </Feature>
</Product>

<Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLFOLDER" Name="TestServiceInstaller" />
        </Directory>
    </Directory>
</Fragment>

<Fragment>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
  <Component Id="TestService.exe" Guid="196BB5E5-F157-4CA2-B740-0A68E1539B7C">
    <File Id="TestService.exe" Source="C:\Users\bryan.johnston\Documents\visual studio 2010\Projects\TestService\TestService\bin\Debug\TestService.exe" KeyPath="yes" />
    <ServiceInstall Id="TestService.exe" Name="TestService.exe" Account="LocalSystem" Arguments="-start" Start="auto" Interactive="yes" Type="ownProcess" Vital="yes" ErrorControl="critical" />
    <ServiceControl Id="TestService.exe" Name="TestService.exe" Stop="both" Start="install" Remove="uninstall" Wait="no" />
  </Component>
    </ComponentGroup>
</Fragment>
    </Wix>
Run Code Online (Sandbox Code Playgroud)


Chr*_*uer 8

ServiceInstall帐户必须是完全限定的,因此:

<ServiceInstall ... Account="NT AUTHORITY\LocalService" />

如果仅指定如下,它可能会失败:

<ServiceInstall ... Account="LocalService" />

  • 同样,我必须将Account ="MyCoolServiceAccount"更改为Account =".\ MyCoolServiceAccount". (2认同)
  • 你让我很快乐! (2认同)