簡體   English   中英

使用PowerShell更改IIS綁定

[英]Changing IIS bindings with PowerShell

我當時正在使用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”上找不到

現在,對於我的生活來說,我無法理解為什么找不到站點“ work”:

PS C:\Windows\system32> Get-WebBinding -Port 80 -Name "work"

protocol        bindingInformation        sslFlags
--------        ------------------        --------
http            :80:work                         0

這些是由PowerShell創建的干凈站點,還創建了相同名稱的應用程序池。

我遇到了同樣的問題,但這是我解決的方法:

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

-BindingInformation應該與在Get-WebBinding命令中看到的相同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM