我们在部署脚本中使用appcmd来设置服务器,我需要确保向现有站点添加绑定不会引发错误
C:\Windows\System32\inetsrv\appcmd.exe set site /site.name:"abc.com"
/+bindings. [protocol='http',bindingInformation='*:80:alias-abc.com']
Run Code Online (Sandbox Code Playgroud)
但是在下一个脚本运行中我得到了错误..
无法使用组合键属性协议添加"绑定"类型的重复集合条目,bindingInformation'分别设置为'http,*:alias-abc.com'
有没有办法在appcmd中添加绑定之前检查绑定是否存在
(不允许使用powershell - 因此必须是appcmd或其他命令行exe)
谢谢
appcmd 在搜索部门有点缺乏,但是像这样的东西应该可以工作:
C:\Windows\system32\inetsrv\appcmd.exe list site "abc.com" | findstr bindings:http/*:80
Run Code Online (Sandbox Code Playgroud)