Wix 安装程序 CAQuietExec 自定义操作

发布于 2024-11-27 12:56:09 字数 1488 浏览 2 评论 0原文

我正在尝试在 Windows Server 2008 上的 Wix 安装程序中执行自定义操作,以授予绑定到 HTTP 套接字的权限。但是安装程序不太工作。

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value="&quot;[SystemFolder]netsh.exe http add urlacl url=http://+:8732/ user=Service_account&quot;" 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.

任何人都可以阐明该命令的情况吗?

I'm trying to execute a custom action in a Wix installer, to grant permission to bind to a HTTP socket, on Windows Server 2008. However the installer isn't quite working.

<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>

Running the installer in debug mode I get the following failure. I also tried running the installer as Administrator, with the same output

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.

Can anyone shed any light on what's up with that command?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猛虎独行 2024-12-04 12:56:09

事实证明,这与正确引用命令有关。 GrantHttpPermission_Cmd 行需要将 " 移动到可执行文件周围,而不是整个命令,并且不需要 [SystemFolder] 部分。最终命令如下所示:

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value=""netsh.exe" http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>

所有其他命令是相同的。

Turns out it was to do with correctly quoting the command. The GrantHttpPermission_Cmd line needed the " moving to around the executable, not the entire command, and the [SystemFolder] part was not required. Final command looked like this:

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value=""netsh.exe" http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>

All the other commands were the same.

近箐 2024-12-04 12:56:09

试试这个:

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value="[SystemFolder]netsh.exe http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>

如果将值括在引号 (") 中,您将得到无效的命令行:

"C:\Windows\System32\netsh.exe http add urlacl url=http://+:8732/ user=Service_account"

Try this:

<CustomAction Id="GrantHttpPermission_Cmd" Property="GrantHttpPermission" Value="[SystemFolder]netsh.exe http add urlacl url=http://+:8732/ user=Service_account" Execute="immediate"/>

If you enclose the value in quotes ("), you will get an invalid command line:

"C:\Windows\System32\netsh.exe http add urlacl url=http://+:8732/ user=Service_account"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文