使用appcmd添加ssl绑定时出错

Gol*_*orn 12 iis https iis-7 appcmd

我想使用appcmd为网站添加绑定.但是当我尝试以下命令时,我收到一个错误:

appcmd set site /site.name:"My site name" /+bindings.[protocol='https',bindingInformation='*:443:sub.mydomain.com'] 
Run Code Online (Sandbox Code Playgroud)

错误:

ERROR ( message:Cannot find SITE object with identifier "bindingInformation='*:443:sub.mydomain.com']". )
Run Code Online (Sandbox Code Playgroud)

我检查了网站是否存在,确实存在.我究竟做错了什么?

nor*_*ben 15

如果您正在使用PowerShell,则必须使用双引号括起bindings参数,以便PowerShell在将命令发送到appcmd之前不会解释单引号.

./appcmd set site /site.name: contoso /+"bindings.[protocol='https',bindingInformation='*:443:']"
Run Code Online (Sandbox Code Playgroud)

来源:http://technet.microsoft.com/en-us/library/cc731692(v = ws.10).aspx


Tom*_*mek 10

试试这个:

appcmd set site "My site name" /bindings:"https://sub.mydomain.com:443"
Run Code Online (Sandbox Code Playgroud)

但你的命令也是正确的.列出所有网站并确保您使用其中一个:

appcmd list site
Run Code Online (Sandbox Code Playgroud)