0

I want to execute this with ant (the command is working is if directly past in cmd)

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

But it is not working. It seems the problem is that I am not escaping something (my suspected are / + [ symbols). I have tried this but it still does not work:

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

This is a segment from my build script

<!-- 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" /> 

The error I am getting from the execution is:

 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).
doreto
  • 3
  • 5

1 Answers1

0

The correctly escaped command was:

<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" />
doreto
  • 3
  • 5