protected static ChannelFactory <IPublishService> CreateChannelFactory() { EndpointAddress endpointAddress = new EndpointAddress(NetSetting.PubAddress); var binding = NetSetting.GetBinding(); var result = new ChannelFactory <IPublishService>(binding, endpointAddress); result.Endpoint.Behaviors.Add(new BusClientBehavior()); return(result); }
protected void MakeProxy(string endpoindAddress, object callbackinstance) { var binding = NetSetting.GetBinding(); EndpointAddress endpointAddress = new EndpointAddress(endpoindAddress); InstanceContext context = new InstanceContext(callbackinstance); DuplexChannelFactory <ISubscribeService> channelFactory = new DuplexChannelFactory <ISubscribeService>(new InstanceContext(this), binding, endpointAddress); channelFactory.Endpoint.Behaviors.Add(new BusClientBehavior()); channelFactory.Open(); _proxy = channelFactory.CreateChannel(); }
public ServerHost() { _publishServiceHost = new ServiceHost(typeof(PublishService)); _subscribeServiceHost = new ServiceHost(typeof(SubscribeService)); var binding = NetSetting.GetBinding(); _publishServiceHost.AddServiceEndpoint(typeof(IPublishService), binding, NetSetting.PubAddress); _subscribeServiceHost.AddServiceEndpoint(typeof(ISubscribeService), binding, NetSetting.SubAddress); _currentDay = DateTime.Now.Day; _timer = new Timer(ShowStats, null, Timeout.Infinite, 5000); }