static void Main(string[] args) { using (ServerBuilder builder = BuildServer(args)) { var server = builder.BuildAsync().GetAwaiter().GetResult(); server.Start(builder.CancelToken); while (Console.In.Peek() == -1) { T.Task.Delay(1000).Wait(); } builder.Logger?.Information("Stop message received, stopping"); builder.Stop(); } }