Why Powershell's New-WebBinding commandlet creates incorrect HostHeader?

后端 未结 3 1444
无人共我
无人共我 2021-01-17 12:08

I am trying to add an MSMQ binding for my IIS Web Site, correct binding should look like this:

\"enter

3条回答
  •  隐瞒了意图╮
    2021-01-17 12:46

    Looking at the decompiled code of the cmdlet, looks like it adding the IPAddress and Port information in the binding and there is no workaround to it.

    Relevant sections from the code:

    private string ipAddress = "*";
    ...
    builder.Append(this.ipAddress);
    ...
    builder.Append(":" + this.sitePort.ToString(CultureInfo.InvariantCulture) + ":");
    

    But you can do what the cmdlet actually does ( below code from cmdlet):

    new-itemproperty -path "IIS:\sites\test" -name bindings -value @{protocol="net.msmq"; bindingInformation="localhost"}
    

提交回复
热议问题