Пример #1
0
        private void Pump()
        {
            try
            {
                _listener = (HttpListenerWrapper)ApplicationHost.CreateApplicationHost(
                    typeof(HttpListenerWrapper), _virtualDir, _physicalDir);
                _listener.Configure(_prefixes, _virtualDir, _physicalDir);
                _listener.Start();

                _ping = new Thread(Ping);
                _ping.Start();

                Console.WriteLine("Listening on:");

                foreach (var pf in _prefixes)
                {
                    Console.WriteLine(pf);
                }

                started.Set();

                while (_listening)
                {
                    _listener.ProcessRequest();
                }
            }
            catch (AppDomainUnloadedException)
            {
                _listening = false;
                _ping.Join();
                Console.WriteLine("Restarting due to unloaded appdomain");
                Start();
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
            }
        }
Пример #2
0
        private void Pump()
        {
            try
              {
            _listener = (HttpListenerWrapper)ApplicationHost.CreateApplicationHost(
            typeof(HttpListenerWrapper), _virtualDir, _physicalDir);
            _listener.Configure(_prefixes, _virtualDir, _physicalDir);
            _listener.Start();

            _ping = new Thread(Ping);
            _ping.Start();

            Console.WriteLine("Listening on:");

            foreach (var pf in _prefixes)
            {
              Console.WriteLine(pf);
            }

            started.Set();

            while (_listening)
              _listener.ProcessRequest();
              }
              catch (AppDomainUnloadedException)
              {
            _listening = false;
            _ping.Join();
            Console.WriteLine("Restarting due to unloaded appdomain");
            Start();
              }
              catch (Exception ex)
              {
            Console.Error.WriteLine(ex);
              }
        }