代码如下:
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
屏蔽红色部分代码,客户端正常运行。