Posted on 2009-05-16 14:51
Frank Xu Lei 阅读(538)
评论(8)
编辑
收藏
网摘 所属分类:
WCF分布式开发常见错误
进行WCF服务终结点配置的过程中,当你配置服务终结点端口,启动服务程序的时候会遇到如下错误,服务无法启动,1.错误信息如下:
IP终结点(端口) 0.0.0.0:8002已经存在一个侦听器,请确保程序中没有多次使用一个终结点,或别的程序没有监听此终结点(端口)
There is already a listener on IP endpoint 0.0.0.0:8002. Make sure that you are not trying to use this endpoint multiple times in your application and that there are no other applications listening on this endpoint.
2.原因:此端口已经被使用,即已经有程序在使用一个相同的端口所致。必须我们配置两个服务终结点使用一个终结点端口
<
endpoint
address = " http://localhost:8002/WCFService "
binding = " wsHttpBinding "
contract = " WCFService.IWCFService " >
</ endpoint >
< endpoint
address = " net.tcp://localhost:8002/WCFService "
binding = " netTcpBinding " bindingName = " netTcpBinding "
contract = " WCFService.IWCFService " >
</ endpoint >
address = " http://localhost:8002/WCFService "
binding = " wsHttpBinding "
contract = " WCFService.IWCFService " >
</ endpoint >
< endpoint
address = " net.tcp://localhost:8002/WCFService "
binding = " netTcpBinding " bindingName = " netTcpBinding "
contract = " WCFService.IWCFService " >
</ endpoint >
运行服务程序就会出现错误。
3.解决办法:
(1)检查机器的端口,确保此端口不是系统服务端口,或者没被其他程序使用。
(2)检查服务终结点配置信息,确保两个不同的服务使用不同的终结点端口
此例中的修改代码改为端口8001即可:
<
endpoint
address = " http://localhost:8001/WCFService "
binding = " wsHttpBinding "
contract = " WCFService.IWCFService " >
</ endpoint >
address = " http://localhost:8001/WCFService "
binding = " wsHttpBinding "
contract = " WCFService.IWCFService " >
</ endpoint >
【老徐的博客】
【作者】:Frank Xu Lei
【地址】:http://www.cnblogs.com/frank_xl/archive/2009/05/16/1458292.html