public ServerInstance(DuplexService <T> service, IBroadCastContract broadcastService) { Thread.CurrentThread.CurrentCulture = new CultureInfo(Config.DefaultLanguage); Close(); try { _service = service; serviceHost = new ServiceHost(_service, new Uri(string.Format("http://localhost:{0}/{1}", _service.ServerMexPort, Namespaces.MainServicePath))); AddCommonEndpoints(typeof(MT), serviceHost, Namespaces.MainServicePath, true, true, _service.ServerListenPort) .Behaviors.Add(new MessageInspector <T>()); serviceHost.Open(); BeforeBroadCastOpen(); serviceHostBroadCast = new ServiceHost(broadcastService, new Uri(string.Format("http://localhost:{0}/{1}", _service.ServerMexPort, Namespaces.BroadcastServicePath))); AddCommonEndpoints(typeof(T), serviceHostBroadCast, Namespaces.BroadcastServicePath, true, false, _service.ServerListenPort) .Behaviors.Add(new MessageInspector <T> { BroadcastPerf = _service.PerfCounters }); // BroadCastService should be opened last, // therefore it can be used during other service construction serviceHostBroadCast.Open(); StartedWithoutErrors = true; Log.Default.Info("Wcf server at port {0} started successfully", _service.ServerListenPort); } catch (Exception commProblem) { Log.Default.Info(commProblem.Message, "ErrorServerOpen"); } }
public ServerChatsInstance(DuplexService <T> service, IBroadCastContract broadcastService) : base(service, broadcastService) { }