public void OpenConnector() { _connector = new TcpBinaryConnector<IManagementService>( _termParams.NetworkName, _termParams.NetworkPort, PublicNames.ManagementService); }
protected override void OnStop() { try { if (_httpListener != null) { _httpListener.Close(); _httpListener = null; } if (_delayedQueue != null) { _delayedQueue.Dispose(); _delayedQueue = null; } if (_queue != null) { _queue.Dispose(); _queue = null; } if (_msConnector != null) { EventLink.Post(ConstHelper.EventSource, _serviceStopped); _msConnector.Dispose(); _msConnector = null; } } catch (Exception ex) { if (_msConnector != null) { EventLink.Post(ConstHelper.EventSource, _serviceStopId, ex); } } }
protected override void OnStart(String[] args) { _msConnector = RemoteControl.CreateConnector(); try { EventLink.Post(ConstHelper.EventSource, String.Format(_helloMessage, ServerVersion)); // создаем очередь заданий на выгрузку _writeSync = new Object(); _queue = new ERPService.CashDe.Upload.Queue(EventLink, WorkingDirectory, _writeSync); // создаем очередь отложенных обновлений _delayedQueue = new ERPService.CashDe.Upload.DelayedQueue( EventLink, _queue, _writeSync, WorkingDirectory); // создаем веб-сервер _httpListener = new HttpListener(); _httpListener.Prefixes.Add(String.Format(_httpPrefix, HttpPort)); _httpListener.Start(); _httpListener.BeginGetContext(RequestCallback, _httpListener); EventLink.Post(ConstHelper.EventSource, _serviceStarted); } catch (Exception ex) { EventLink.Post(ConstHelper.EventSource, _serviceStartId, ex); Stop(); } }
public void Dispose() { if (_connector != null) { _connector.Dispose(); _connector = null; } }