public override void Stop() { _httpInboundAdapter.Stop(); _httpRouter.Stop(); foreach (IHttpProcessor p in _httpProcessors.Values) { p.StopProcessor(); } _httpOutboundAdapter.Stop(); }
static void Main(string[] args) { Init().Wait(); // Wait until the app unloads or is cancelled var cts = new CancellationTokenSource(); AssemblyLoadContext.Default.Unloading += (ctx) => cts.Cancel(); Console.CancelKeyPress += (sender, cpe) => cts.Cancel(); WhenCancelled(cts.Token).Wait(); http.Stop(); }