Beispiel #1
0
        public static void Main(string[] args)
        {
            var responder = new KestrelResponder();

            using (var listener = new DistributingKestrelServer(8080))
            {
                listener.AddResponder(responder);
                listener.Start();

                if (Console.IsInputRedirected)
                {
                    Thread.Sleep(Timeout.Infinite);
                }
                else
                {
                    Console.WriteLine("Press Enter or Escape to stop.");
                    for (;;)
                    {
                        ConsoleKeyInfo key = Console.ReadKey(intercept: true);
                        if (key.Key == ConsoleKey.Enter || key.Key == ConsoleKey.Escape)
                        {
                            break;
                        }
                    }
                }

                listener.Stop();
            }
        }
Beispiel #2
0
        public void Start(string[] startupArguments, ServiceStoppedCallback serviceStoppedCallback)
        {
            var responder = new KestrelResponder();

            _listener = new DistributingKestrelServer(8080);
            _listener.AddResponder(responder);
            _listener.Start();
        }