Exemplo n.º 1
0
 public Request(Server server, Host host, Connection connection)
     : base(String.Empty, String.Empty, null)
 {
     _server = server;
     _host = host;
     _connection = connection;
 }
Exemplo n.º 2
0
 public void HostStopped()
 {
     _host = null;
 }
Exemplo n.º 3
0
        public void Stop()
        {
            _shutdownInProgress = true;

            try {
                if (_socket != null) {
                    _socket.Close();
                }
            }
            catch {
            }
            finally {
                _socket = null;
            }

            try {
                if (_host != null) {
                    _host.Shutdown();
                }

                while (_host != null) {
                    Thread.Sleep(100);
                }
                Thread.Sleep(500);
            }
            catch {
            }
            finally {
                _host = null;
            }
        }
Exemplo n.º 4
0
        public Host GetHost()
        {
            if (_shutdownInProgress)
                return null;

            Host host = _host;

            if (host == null) {
                lock (this) {
                    host = _host;
                    if (host == null) {
                        try {
                            host = (Host)CreateWorkerAppDomainWithHost(_virtualPath, _physicalPath, typeof(Host));
                            host.Configure(this, _port, _virtualPath, _physicalPath);
                            _host = host;
                        } catch (System.Security.SecurityException sx) {
                            //Edit by NDJ, Apr. 19 2011:
                            //Unless we catch this exception, the server silently fails to respond instead of providing a status 500
                            Debug.WriteLine("Failed to create hosting app domain: " + sx.Message + sx.StackTrace);
                        }
                    }
                }
            }

            return host;
        }