public void StopServer() { try { if (_hostDiretorSkinner != null) { if (_hostDiretorSkinner.State == CommunicationState.Opened) { _hostDiretorSkinner.Close(); } _hostDiretorSkinner = null; } } catch (CommunicationException ex) { EventLog.WriteEntry(ex.Message); if (_hostDiretorSkinner != null) { _hostDiretorSkinner.Abort(); } } finally { if (_server != null) { _server.Dispose(); _server = null; } } }
public void StartServer() { try { _server = new DiretorSkinner(); _hostDiretorSkinner = new ServiceHost(_server); Binding tcpBinding = CreateTcpBinding(); //Use base address as address string _hostString = ConfigurationManager.AppSettings["Host"]; _hostDiretorSkinner.Open(); } catch (CommunicationException ex) { EventLog.WriteEntry(ex.Message); } }