Exemplo n.º 1
0
        private void StopServiceHostStorage()
        {
            try
            {
                _logger.Info("StopServiceHostStorage -> stopping service document storage...");
                Journaling.WriteJournaling(LoggingSource.BiblosDS_WindowsService_WCFHost,
                                           "StopServiceHostStorage", string.Empty, "Stop", LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Trace,
                                           null, null, null);

                if (_serviceHostStorage != null)
                {
                    _serviceHostStorage.Close();
                    _serviceHostStorage = null;
                }
            }
            catch (Exception ex)
            {
                _logger.Error("StopServiceHostStorage -> error on stop service document storage", ex);
                Logging.WriteLogEvent(LoggingSource.BiblosDS_WindowsService_WCFHost, "StopServiceHostStorage",
                                      string.Concat("Error occured when stop service document storage : ", ex.ToString()), LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Managed_Error);
            }
        }
Exemplo n.º 2
0
        private void StartServiceHostPreservation()
        {
            try
            {
                _logger.Info("StartServiceHostPreservation -> hosting and start service preservation...");
                Journaling.WriteJournaling(LoggingSource.BiblosDS_WindowsService_WCFHost, "StartServiceHostPreservation", string.Empty, "Start",
                                           LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Trace, null, null, null);

                if (_serviceHostPreservation != null)
                {
                    _serviceHostPreservation.Close();
                }

                _serviceHostPreservation = new ServiceHost(typeof(ServicePreservation));
                _serviceHostPreservation.Open();
                _logger.Info("StartServiceHostPreservation -> service preservation started correctly");
            }
            catch (Exception ex)
            {
                _logger.Error("StartServiceHostPreservation -> error on start service preservation", ex);
                Logging.WriteLogEvent(LoggingSource.BiblosDS_WindowsService_WCFHost, "StartServiceHostPreservation",
                                      string.Concat("Error occured when start service preservation : ", ex.ToString()), LoggingOperationType.BiblosDS_General, LoggingLevel.BiblosDS_Errors);
            }
        }