我想用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:"Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:'] 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).发布于 2016-01-14 19:09:36
正确转义的命令是:
<staf location="local"
service="PROCESS"
request="START COMMAND "C:\\Windows\\system32\\inetsrv\\Appcmd set site /site.name:\"Default Web Site\" /+bindings.[protocol='https',bindingInformation='*:443:']" WAIT STDERRTOSTDOUT RETURNSTDOUT"
throwBuildException="STAF ERROR" />https://stackoverflow.com/questions/34767265
复制相似问题