为了账号安全,请及时绑定邮箱和手机立即绑定

在控制台宿主程序中,为什么不能同时实例化两个ServiceHost?

在控制台宿主程序中,为什么不能同时实例化两个ServiceHost?

侃侃尔雅 2018-10-10 08:05:32
代码如下: using (ServiceHost                 DuplexCommonHost = new ServiceHost(typeof(DuplexCommonService)),                 OneWayCommonHost = new ServiceHost(typeof(OneWayCommonService)))            {                DuplexCommonHost.Opened += delegate { Console.Write("DuplexCommon service has been opened!"); };                DuplexCommonHost.Open();                OneWayCommonHost.Opened += delegate { Console.Write("OneWayCommon service has been opened!"); };                OneWayCommonHost.Open();                Console.Read();               }结果客户端报一下错误:没有终结点在侦听可以接受消息的 http://localhost:8080/OneWayCommon屏蔽红色部分代码,客户端正常运行。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 608 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信