Ejemplo n.º 1
0
        /// <summary>
        /// Starts the external web socket server.
        /// </summary>
        private void ReloadExternalWebSocketServer(int portNumber)
        {
            DisposeExternalWebSocketServer();

            ExternalWebSocketServer = _applicationHost.Resolve <IWebSocketServer>();

            ExternalWebSocketServer.Start(portNumber);
            ExternalWebSocketServer.WebSocketConnected += HttpServer_WebSocketConnected;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts the external web socket server.
        /// </summary>
        private void ReloadExternalWebSocketServer()
        {
            DisposeExternalWebSocketServer();

            ExternalWebSocketServer = _applicationHost.Resolve <IWebSocketServer>();

            ExternalWebSocketServer.Start(ConfigurationManager.Configuration.LegacyWebSocketPortNumber);
            ExternalWebSocketServer.WebSocketConnected += HttpServer_WebSocketConnected;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Opens the specified URL in an external browser window. Any exceptions will be logged, but ignored.
 /// </summary>
 /// <param name="appHost">The application host.</param>
 /// <param name="relativeUrl">The URL to open, relative to the server base URL.</param>
 private static void TryOpenUrl(IServerApplicationHost appHost, string relativeUrl)
 {
     try
     {
         string baseUrl = appHost.GetLocalApiUrl("localhost");
         appHost.LaunchUrl(baseUrl + relativeUrl);
     }
     catch (Exception ex)
     {
         var logger = appHost.Resolve <ILogger>();
         logger?.LogError(ex, "Failed to open browser window with URL {URL}", relativeUrl);
     }
 }
        /// <summary>
        /// Restarts the Http Server, or starts it if not currently running
        /// </summary>
        private void ReloadHttpServer(string[] urlPrefixes)
        {
            _logger.Info("Loading Http Server");

            try
            {
                HttpServer = _applicationHost.Resolve <IHttpServer>();
                HttpServer.StartServer(urlPrefixes);
            }
            catch (Exception ex)
            {
                var msg = string.Equals(ex.GetType().Name, "SocketException", StringComparison.OrdinalIgnoreCase)
                    ? "The http server is unable to start due to a Socket error. This can occasionally happen when the operating system takes longer than usual to release the IP bindings from the previous session. This can take up to five minutes. Please try waiting or rebooting the system."
                    : "Error starting Http Server";

                _logger.ErrorException(msg, ex);

                throw;
            }

            HttpServer.WebSocketConnected += HttpServer_WebSocketConnected;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Restarts the Http Server, or starts it if not currently running
        /// </summary>
        private void ReloadHttpServer(IEnumerable <string> urlPrefixes)
        {
            _logger.Info("Loading Http Server");

            try
            {
                HttpServer = _applicationHost.Resolve <IHttpServer>();
                HttpServer.StartServer(urlPrefixes);
            }
            catch (SocketException ex)
            {
                _logger.ErrorException("The http server is unable to start due to a Socket error. This can occasionally happen when the operating system takes longer than usual to release the IP bindings from the previous session. This can take up to five minutes. Please try waiting or rebooting the system.", ex);

                throw;
            }
            catch (Exception ex)
            {
                _logger.ErrorException("Error starting Http Server", ex);

                throw;
            }

            HttpServer.WebSocketConnected += HttpServer_WebSocketConnected;
        }
Ejemplo n.º 6
0
 public override T Resolve <T>()
 {
     return(_appHost.Resolve <T>());
 }