Exemplo n.º 1
0
        public void Configure(WebServer server, int port, string virtualPath, string physicalPath)
        {
            _server = server;

            _port = port;
            _installPath = null;
            _virtualPath = virtualPath;

            _lowerCasedVirtualPath = CultureInfo.InvariantCulture.TextInfo.ToLower(_virtualPath);
            _lowerCasedVirtualPathWithTrailingSlash = virtualPath.EndsWith("/", StringComparison.Ordinal) ? virtualPath : virtualPath + "/";
            _lowerCasedVirtualPathWithTrailingSlash = CultureInfo.InvariantCulture.TextInfo.ToLower(_lowerCasedVirtualPathWithTrailingSlash);
            _physicalPath = physicalPath;
            _physicalClientScriptPath = HttpRuntime.AspClientScriptPhysicalPath + "\\";
            _lowerCasedClientScriptPathWithTrailingSlash = CultureInfo.InvariantCulture.TextInfo.ToLower(HttpRuntime.AspClientScriptVirtualPath + "/");
        }
 internal Connection(WebServer server, Socket socket)
 {
     _server = server;
     _socket = socket;
 }
 public Request(WebServer server, Host host, Connection connection)
     : base(String.Empty, String.Empty, null)
 {
     _server = server;
     _host = host;
     _connection = connection;
 }
 /// <summary>
 /// Stops the web server.
 /// </summary>
 private bool StopWebServer()
 {
     try
     {
         if (webServer != null)
         {
             log.Info("Stopping web server");
             webServer.Stop();
             webServer = null;
             log.Info("Web server stopped");
         }
         return true;
     }
     catch (Exception ex)
     {
         log.Error(string.Format("Error starting web server: [{0}]", ex.Message), ex);
         return false;
     }
 }
        /// <summary>
        /// Starts the web server.
        /// </summary>
        private bool StartWebServer()
        {
            if (StopWebServer())
            {
                try
                {
                    log.Info("Starting web server");

                    string appPath = AppConfigSettings.GetString(ConfigParameter.WebServerAppPath);
                    string virtRoot = AppConfigSettings.GetString(ConfigParameter.WebServerVirtualPath);
                    int port = AppConfigSettings.GetInt(ConfigParameter.WebServerPort);

                    webServer = new WebServer(port, virtRoot, appPath);
                    webServer.Start();

                    log.Info("Web server started");
                    return true;
                }
                catch (Exception ex)
                {
                    StopWebServer();
                    log.Error(string.Format("Error starting web server: [{0}]", ex.Message), ex);
                    return false;
                }
            }
            else
            {
                return false;
            }
        }