WCF开发常见问题:“There is already a listener on IP endpoint 0.0.0.0:4503”

在寄宿到控制台的WCF服务启动时或者运行期间,经常自己停掉,通过日志记录可以看到

2010/10/27 10:19:08 : There is already a listener on IP endpoint 0.0.0.0:4503.  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.

应该是同一个端口被多个服务监听了,查了一下服务的配置,果然如此

 

ExpandedBlockStart.gif 代码
< service  behaviorConfiguration ="WCFService.Behavior"  name ="WCFService.SynchronizationService" >  
        
< host >  
          
< baseAddresses >  
            
< add  baseAddress ="net.tcp://localhost:4503/SynchronizationService" />  
          
</ baseAddresses >  
        
</ host >  
        
< endpoint  address =""  binding ="netTcpBinding"  contract ="WCFService.ISynchronizationService"  bindingConfiguration ="netTcpBindConfig" ></ endpoint >  
        
< endpoint  address ="mex"  binding ="mexTcpBinding"  contract ="IMetadataExchange"   ></ endpoint >  
      
</ service >

      
< service  behaviorConfiguration ="WCFService.Behavior"  name ="AuthenticateService" >  
        
< host >  
          
< baseAddresses >  
            
< add  baseAddress ="net.tcp://localhost:4503/AuthenticateService" />  
          
</ baseAddresses >  
        
</ host >  
        
< endpoint  address =""  binding ="netTcpBinding"  contract ="IAuthenticateService"  bindingConfiguration ="netTcpBindConfig" ></ endpoint >  
        
< endpoint  address ="mex"  binding ="mexTcpBinding"  contract ="IMetadataExchange"   ></ endpoint >  
      
</ service >

 

于是将其中一个服务的端口改掉成4504即可。

为了保证端口的唯一性,首先这个端口不能是常见的系统端口,其次不能是其他服务所用的端口。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值