WCF分布式开发常见错误(21)2011-06-17 博客园 Frank Xu LeiWCF分布式开发常见错误(21):unable to open its IChannelListener.分发器未能打开侦听器我在进行WCF基于 UserName 和 Passoword的安全验证编程的时候遇到这个 错误:The ChannelDispatcher at "http://localhost:8001/WCFService" with contract(s) ""IWCFService"" is unable to open its IChannelListener. "http://localhost:8001/WCFService" with contract(s) ""IWCFService的 通道分发器未能通道打开侦听器。WCF安全问题一直困扰很多人,相信很多WCF学 习者也对此非常头疼。这个错误我尝试了很久都没有解决。后来我把此问题发到 WCF英文论坛,有个老外Rodrigo回答了我问题,但是没有直接答案,算是给了我 一个提示。因为之前我猜测WCF安全模式里可以不适用证书。因为WSE3.0里我记 得就不需要使用。他告诉了WCF安全强制要求提供证书【1】原问题地址: http://social.microsoft.com/Forums/zh-CN/wcf/threads:I have a question for WCF UserName and Passoword Validation.I use Message security mode,but and NetTcpBinding,Console Selfhost.But when I run the host application,Then throwed an exception:The ChannelDispatcher at "net.tcp://localhost:9001/WCFService" with contract(s) ""IWCFService"" is unable to open its IChannelListener.I have try to solve it myself,But ,all methods are helpless,When I remove the codes in the config file it is ok :
<binding name="MessageAndUserName" >
<security mode="Message">
<message algorithmSuite="Basic256" clientCredentialType="UserName"/>
</security>
</binding>
is there anyone can give some tips?Thanks a lot错误截图:

-----------------------------------------------------------------【2】原因:因为这里WCF服务使用的安全模型为:Message。WCF要求消息安全必须提供证 书支持。而配置文件里没有设置。所以才出现这个错误。我搜索的此错误的很多帖子,基本问题和解决方法都不清晰,导致这个问题 的原因很多。我最后把这个问题发到WCF的英文论坛,期待能有帮助的答案出现 。