继续我在这里报道的第一期: Running an OS command using apache-ant to IIS config
我正在尝试运行IIS配置的第二部分。
<exec executable="cmd.exe" dir="C:/Windows/System32/inetsrv"
failonerror="true">
<arg line="/c appcmd set config /section:handlers
/[name='ExtensionlessUrlHandler-Integrated-
4.0'].verb:GET,POST,PUT,DELETE,OPTIONS,CONNECT"/>
</exec>
我这行没有双引号,我正在使用'表明我的单引号。但是我收到了以下错误,我正在努力寻找解释:
confIIS:
[echo] Configuring IIS
[exec] ERROR ( message:Malformed collection indexer; format is
[@position,name='value',name2='value2',...]. The @position specifier is
optional, and be '@start', '@end', or
@N' where N is a numeric index into the collection. )
快速更新: 我试过dbl引号但没有运气。我已经做了一些挖掘,问题是单引号被删除了。 如果我在没有单引号的dos提示符下运行cmd行,它将以相同的方式失败。 cmd行:
appcmd set config /section:handlers /[name='ExtensionlessUrlHandler-
Integrated-4.0'].verb:GET
Ant脚本(调试)输出
[exec] 'appcmd'
[exec] 'set'
[exec] 'config'
[exec] '/section:handlers'
[exec] '/[name=ExtensionlessUrlHandler-Integrated-
4.0].verb:GET,POST,PUT,DELETE,OPTIONS,CONNECT'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
ute:Java13CommandLauncher: Executing 'cmd.exe' with arguments: