【问题标题】:Command for creating https binding for the Site with ANT使用 ANT 为站点创建 https 绑定的命令
【发布时间】:2016-01-13 12:52:20
【问题描述】:

我想用 ant 来执行这个(如果直接在 cmd 中过去,命令是有效的)

%windir%\system32\inetsrv\Appcmd set site /site.name:"Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:']

但它不起作用。似乎问题在于我没有逃避某些东西(我怀疑是 / + [ 符号)。这个我试过了,还是不行:

C:\Windows\system32\inetsrv\Appcmd set site /site.name:"Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:'] 

这是我的构建脚本中的一个片段

<!-- Create the actual https binding for the Site -->
    <staf location="local"
        service="PROCESS"
        request="START COMMAND netsh http add sslcert ipport=0.0.0.0:443 certstorename=MY certhash=${local.machine.certhash} appid={${local.machine.keycontainer}} WAIT STDERRTOSTDOUT RETURNSTDOUT"
        throwBuildException="STAF ERROR" /> 

    <staf location="local"
        service="PROCESS"
        request="START  COMMAND %windir%\system32\inetsrv\Appcmd set site /site.name:&quot;Default Web Site&quot; /+bindings.[protocol=&apos;https&apos;,bindingInformation=&apos;*:443:&apos;] WAIT STDERRTOSTDOUT RETURNSTDOUT"
        throwBuildException="STAF ERROR" /> 

我从执行中得到的错误是:

 RC=0, Result=
 [staf] {
 [staf]   Return Code: 87
 [staf]   Key        : <None>
 [staf]   Files      : [
 [staf]     {
 [staf]       Return Code: 0
 [staf]       Data       : Failed to process input: The parameter 'Site' must begin with a / or - (HRESULT=80070057).

【问题讨论】:

  • 添加您正在尝试的当前构建脚本?

标签: iis ant ssl-certificate appcmd staf


【解决方案1】:

正确转义的命令是:

<staf location="local"
                service="PROCESS"
                request="START COMMAND &quot;C:\\Windows\\system32\\inetsrv\\Appcmd set site /site.name:\&quot;Default Web Site\&quot; /+bindings.[protocol=&apos;https&apos;,bindingInformation=&apos;*:443:&apos;]&quot; WAIT STDERRTOSTDOUT RETURNSTDOUT"
                throwBuildException="STAF ERROR" />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-21
    • 2018-09-02
    • 2019-04-20
    相关资源
    最近更新 更多