示例#1
0
        /// <summary>
        /// Method to start the server.
        /// </summary>
        public static void Start()
        {
            // Check if the server is started.
            if (!HttpWebServerApplication.IsStarted)
            {
                try
                {
                    // Try to get server informations
                    ServerData server = ApplicationBase.Options.Remote.Servers.FindDefaultFirst();

                    if (server != null)
                    {
                        HttpWebServerApplication.Start(server.Host, server.Port);
                        log.Info(Properties.Logs.ServerStarted);
                    }

                    NotifyServerStarted();
                }
                catch (Exception ex)
                {
                    log.Error(ex.Output(), ex);
                    MessageBoxs.Warning(ex.Output(), ex.GetType().Name);

                    NotifyServerFailed();
                }
            }
            else
            {
                log.Warn("Server is already started.");
            }
        }
示例#2
0
        /// <summary>
        /// Method to stop the server.
        /// </summary>
        public static void Stop()
        {
            HttpWebServerApplication.Stop();
            log.Info(Properties.Logs.ServerStopped);

            NotifyServerStopped();
        }