測試WCF MSMQ編程時候遇到這個錯誤:綁定協議驗證失敗,具體信息:Binding validation failed because the binding's MsmqAuthenticationMode property is set to WindowsDomain but MSMQ is installed with Active Directory integration disabled. The channel factory or service host cannot be opened.
如圖:
原因:
MSMQ驗證模式設置為 WindowsDomain,但是MSMQ安裝活動目錄AD禁用。通道工廠或者服務宿主不能打開。
解決辦法:
(1)在配置文件裡添加綁定設置節點:
<bindings>
<netMsmqBinding>
<binding name="msmq">
<security mode="None">
</security>
</binding>
</netMsmqBinding>
</bindings>
(2)在服務終結點裡,引用這個配置,來設置MSMQ的安全模式:
<endpoint
address="net.msmq://localhost/WCFMSMQService"
binding="netMsmqBinding"
contract="WCFService.IWCFMSMQService" bindingConfiguration="msmq" >
</endpoint>
當然這些也可以通過編程來實現~