Пример #1
0
 public static void Stop()
 {
     try
     {
         PLogger.LogInformation("Host is stopping...");
         if (host != null)
         {
             host.Close();
         }
         PLogger.LogInformation("Host has stopped.");
     }
     catch (Exception ex)
     {
         try
         {
             if (host != null)
             {
                 host.Abort();
             }
         }
         catch
         {
         }
         PLogger.LogError(ex);
     }
     finally
     {
         host = null;
     }
 }
Пример #2
0
 public static void Start()
 {
     try
     {
         PLogger.LogInformation("Host is starting...");
         if (host == null)
         {
             host = new ServiceHost(typeof(ServiceBE));
             host.Open();
         }
         PLogger.LogInformation("Host has started.");
     }
     catch (Exception ex)
     {
         try
         {
             if (host != null)
             {
                 host.Abort();
             }
         }
         catch
         {
         }
         finally
         {
             host = null;
         }
         PLogger.LogError(ex);
     }
 }