测试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>
<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>
address="net.msmq://localhost/WCFMSMQService"
binding="netMsmqBinding"
contract="WCFService.IWCFMSMQService" bindingConfiguration="msmq" >
</endpoint>
当然这些也可以通过编程来实现~
本文转自 frankxulei 51CTO博客,原文链接:http://blog.51cto.com/frankxulei/320439,如需转载请自行联系原作者