我正在尝试在Wix安装程序中执行自定义操作,以在Windows Server 2008上授予绑定到HTTP套接字的权限。但是安装程序不能正常工作。
<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value=""[SystemFolder]netsh.exe http add urlacl url=http://+:8732/ user=Service_account"" Execute="immediate"/>
<CustomAction Id="GrantHttpPermission" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no"/>
...
<InstallExecuteSequence>
<Custom Action="GrantHttpPermission_Cmd" After="CostFinalize"/>
<Custom Action="GrantHttpPermission" After="ConfigureUsers">NOT Installed</Custom>
</InstallExecuteSequence>
在调试模式下运行安装程序我遇到以下故障。我也尝试以管理员身份运行安装程序,输出相同
MSI (s) (14:20) [11:03:00:440]: Executing op: CustomActionSchedule(Action=GrantHttpPermission,ActionType=3073,Source=BinaryData,Target=CAQuietExec,CustomActionData="C:\Windows\SysWOW64\netsh.exe http add urlacl url=http://+:8732/ user=Service_account")
MSI (s) (14:24) [11:03:00:440]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIF794.tmp, Entrypoint: CAQuietExec
CAQuietExec: Error 0x80070002: Command failed to execute.
CAQuietExec: Error 0x80070002: CAQuietExec Failed
CustomAction GrantHttpPermission returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 11:03:00: InstallFinalize. Return value 3.
任何人都可以了解该命令的内容吗?
答案 0 :(得分:9)
原来这与正确引用命令有关。 GrantHttpPermission_Cmd
行需要“移动到可执行文件周围,而不是整个命令,并且[SystemFolder]
部分不是必需的。最终命令看起来像这样:
<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value=""netsh.exe" http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>
所有其他命令都是相同的。
答案 1 :(得分:1)
试试这个:
<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value="[SystemFolder]netsh.exe http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>
如果将值括在引号(&amp; quot;)中,您将得到一个无效的命令行:
"C:\Windows\System32\netsh.exe http add urlacl url=http://+:8732/ user=Service_account"