static void Main(string[] args) { var listeningOn = args.Length == 0 ? "http://*:1337/" : args[0]; using (var appHost = new AppSelfHost()) { try { appHost.Init(); appHost.Start(listeningOn); Console.WriteLine("AppHost Created at {0}, listening on {1}", DateTime.Now, listeningOn); Console.WriteLine("Press <CTRL>+C to stop."); Thread.Sleep(Timeout.Infinite); } catch (Exception ex) { Console.WriteLine("ERROR: {0}: {1}", ex.GetType().Name, ex.Message); throw; } finally { appHost.Stop(); } } Console.WriteLine("AppHost has finished"); }
static void Main(string[] args) { var listeningOn = args.Length == 0 ? "http://*:1337/" : args[0]; using (var appHost = new AppSelfHost()) { try { appHost.Init(); // TODO: switch to Start after the next ServiceStack deployment (added to framework on commit #806) appHost.StartListening(listeningOn); } catch (Exception ex) { Console.WriteLine("ERROR: {0}: {1}", ex.GetType().Name, ex.Message); } finally { appHost.Stop(); } } Console.WriteLine("AppHost has finished"); }