gpt4 book ai didi

c# - WIX CAQuietExec NETSH 命令失败

转载 作者:太空宇宙 更新时间:2023-11-03 10:59:28 31 4
gpt4 key购买 nike

我希望我的 WIX 安装程序安静地调用 NETSH 命令以将自签名证书绑定(bind)到 IP 地址:端口。

正在调用 CAQuietExec,但 NETSH 命令失败。

MSI (s) (C4:84) [16:19:50:455]: Executing op: CustomActionSchedule(Action=customQtExecRtBindCertToPort,ActionType=3137,Source=BinaryData,Target=CAQuietExec,CustomActionData="netsh" http add sslcert ipport=0.0.0.0:8080 certhash=2B2C23C6B1334F886B9FFD827D64BDC072BBEFD7 appid={123456-7890-12345-4567-AAABBBCCCDDDFFFF})
MSI (s) (C4:8C) [16:19:50:457]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI87DB.tmp, Entrypoint: CAQuietExec
MSI (s) (C4:78) [16:19:50:457]: Generating random cookie.
MSI (s) (C4:78) [16:19:50:458]: Created Custom Action Server with PID 2588 (0xA1C).
MSI (s) (C4:38) [16:19:50:477]: Running as a service.
MSI (s) (C4:38) [16:19:50:479]: Hello, I'm your 32bit Elevated custom action server.
CAQuietExec:
CAQuietExec: SSL Certificate add failed, Error: 1312
CAQuietExec: A specified logon session does not exist. It may already have been terminated.

A specified logon session does not exist. It may already have been terminated.

当我从命令 shell 运行完全相同的命令时,我成功了:

>SSL Certificate successfully added

我的代码相当简单:

    <CustomAction
Id="customQtExecRtBindCertToPortData"
Property="customQtExecRtBindCertToPort"
Value="&quot;netsh&quot; http add sslcert ipport=0.0.0.0:[RT_PORT] certhash=[CERT_THUMBPRINT] appid={123456-7890-12345-4567-AAABBBCCCDDDFFFF}"
/>
<CustomAction
Id="customQtExecRtBindCertToPort"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="ignore"
Impersonate="no"
/>

我已经尝试在 Windows Server 2008 R2 中以提升的权限运行,但仍然收到相同的日志输出。

最佳答案

在尝试修改我的安装程序以调用自定义控制台应用程序时,该应用程序在后台调用 NETSH(以及其他一些任务),我发现了我认为是实际问题的地方。

虽然我的 CustomAction 声明正确设置了 Execute="deferred"和 Impersonate="no"属性,但我相信当时的安装顺序没有正确定义为发生在 InstallInitialize 之间>InstallFinalize,如该链接中所述:Installation change do not ask for UAC permissions .

使用 UAC 和所有有趣的东西部署到 W2K12,带来了同样的错误,然后在将我的自定义操作安装程序序列设置为以下时,我能够克服定义的问题。

        <Custom
Action="customQtExecRTBindCertToPortData"
Before="InstallFinalize"
>
<![CDATA[NOT Installed AND CERTIFICATE_NEEDED = "TRUE" AND &featureServices = 3 ]]>
</Custom>
<Custom
Action="customQtExecRTBindCertToPort"
After="customQtExecRTBindCertToPortData"
>
<![CDATA[NOT Installed AND CERTIFICATE_NEEDED = "TRUE" AND &featureServices = 3 ]]>
</Custom>

关于c# - WIX CAQuietExec NETSH 命令失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18218672/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com