public static void Main(string[] args) { var p = new Carriage(args); try { p.StartConsole(); if (p.PrintHelp()) return; p.ParseProgramArgs(); p.PrintParameters(p.MyParameters); //AppDomain var myApp = (Engine) System.Web.Hosting.ApplicationHost.CreateApplicationHost(typeof(Engine), Engine.V_DIR, p.MyParameters.AppDomain); p.PrintToConsole( $"Application domain created at '{p.MyParameters.AppDomain}'"); //asp fitting myApp.AspFitting(new[] {p.MyParameters.AspListenerPrefix}, Engine.V_DIR, p.MyParameters.AppDomain); //start the engine myApp.LaunchHost(); } catch (Exception ex) //exceptions move up the entire stack to the main, get caught and the exe exits. { p.PrintToConsole(ex); } Console.Out.WriteLine("press any key to exit..."); Console.ReadKey(); }
public static void Main(string[] args) { var p = new Carriage(args); try { p.StartConsole(); if (p.PrintHelp()) { return; } p.ParseProgramArgs(); p.PrintParameters(p.MyParameters); //AppDomain var myApp = (Engine) System.Web.Hosting.ApplicationHost.CreateApplicationHost(typeof(Engine), Engine.V_DIR, p.MyParameters.AppDomain); p.PrintToConsole( $"Application domain created at '{p.MyParameters.AppDomain}'"); //asp fitting myApp.AspFitting(new[] { p.MyParameters.AspListenerPrefix }, Engine.V_DIR, p.MyParameters.AppDomain); //start the engine myApp.LaunchHost(); } catch (Exception ex) //exceptions move up the entire stack to the main, get caught and the exe exits. { p.PrintToConsole(ex); } Console.Out.WriteLine("press any key to exit..."); Console.ReadKey(); }