【问题标题】:Changing IIS bindings with PowerShell使用 PowerShell 更改 IIS 绑定
【发布时间】:2018-07-09 01:10:24
【问题描述】:

我希望在 Windows 21012 R2 上使用 PowerShell 将 Web 绑定端口从一个站点移动到另一个站点。

上网查了一下,找到了这个命令

Set-WebBinding -Name 'work' -BindingInformation "*:80:" -PropertyName Port -Value 1234

现在命令来自 MS 博客,但每次运行命令时都会出现以下错误。

警告:目标配置对象 '/system.applicationHost/sites/site[compare-string-ordinal(@name,'work',true())=0]/bindings/binding[(@protocol='http'或 @protocol='https') 和 compare-string-ordinal(@bindingInformation,'*:80:',true())=0] 在路径 'MACHINE/WEBROOT/APPHOST' 中找不到

现在我这辈子都无法理解为什么它没有找到“工作”的网站:

PS C:\Windows\system32> Get-WebBinding -Port 80 -Name "work" 协议绑定信息 sslFlags -------- ------ -------- http :80:工作 0

这些是由 PowerShell 创建的干净站点,它们还会创建同名的应用程序池。

【问题讨论】:

    标签: powershell iis windows-server-2012-r2


    【解决方案1】:

    我遇到了同样的问题,但我是这样解决的:

    Set-WebBinding -Name 'work' -BindingInformation ":80:" -PropertyName Port -Value 1234
    

    -BindingInformation 应该与您使用 Get-WebBinding 命令看到的相同。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-03-29
      • 2018-01-08
      • 2012-04-24
      • 1970-01-01
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多