2012-02-24 90 views
10

我想添加一个MSMQ对我的IIS网站结合,正确的结合应该是这样的:为什么Powershell的New-WebBinding命令行开关创建不正确的HostHeader?

enter image description here

所以我执行以下行PowerShell中:

New-WebBinding -Name "My Site" -Protocol net.msmq -HostHeader "localhost" 

,它创建以下绑定:

enter image description here

prefi使用*:80:来激活它,所以我的MSMQ消息不会被WCF服务拾取。也许我做错了?如何使用此PowerShell命令创建绑定信息设置为“localhost”的绑定?

Commandlet codumentaiton可以找到here

回答

6

望着cmdlet的反编译的代码,看起来像是在绑定添加ip地址和端口信息,并没有解决方法吧。

从代码有关章节:

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

但是你可以做什么的小命令实际上做(下面的代码来自cmdlet的):

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

噢,你能告诉我如何反编译cmdlet吗?谢谢。 – Restuta 2012-02-24 17:46:15

+0

@Restuta Checkout [ILSpy](http://wiki.sharpdevelop.net/ILSpy.ashx)和[dotPeek](http://www.jetbrains.com/decompiler/)。 – 2012-02-24 17:55:39

+0

我知道他们,但我需要分解什么样的组件? – Restuta 2012-02-24 18:33:12

2

试试这个:

New-ItemProperty "IIS:\sites\NameOfYourSite" -name bindings -value @{protocol="net.msmq";bindingInformation="localhost"} 
+0

我不断收到以下错误做新 - 当itemproperty方式:New-ItemProperty:无法找到接受参数'System.Collections.Hashtable'的位置参数。这似乎是我认为的-value参数。有什么建议么? – Acquire 2013-12-02 23:58:05

+0

@Acquire嗯应该工作,你导入了网络管理模块? – 2013-12-03 01:58:40

相关问题