Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            try
            {
                // Initialize the application configuration
                Program.AppConfig = new AppConfig(true);

                // Parse the startup arguments, and apply them to the configuration
                AppConfigParameterParser.Parse(args, Program.AppConfig);

                // Set up a new webhost
                var host = new WebHostBuilder()
                           .UseUrls("http://*:5000")
                           .UseKestrel()
                           .UseContentRoot(Directory.GetCurrentDirectory())
                           .UseIISIntegration()
                           .UseStartup <Startup>()
                           .Build();

                // Run the actual web host
                host.Run();
            }
            catch (Exception ex)
            {
                // Print the exception
                Console.WriteLine(ex);

                // Show a warning
                Console.WriteLine(
                    "\n\nAn unrecorerable exception occurred.\nThe application will not quit (code: -1).");

                // Exit
                Environment.Exit(-1);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main application entry point.
        /// </summary>
        /// <param name="args">Startup arguments.</param>
        public static void Main(string[] args)
        {
            // Show a program initialization message
            LogUtils.Info("Starting " + APP_NAME + " v" + APP_VERSION_NAME + " (" + APP_VERSION_CODE + ")...");

//#if DEBUG
//            // Enable development environment and debugging features
//            Environment.SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Development");
//            LogUtils.Info("Enabled development environment.");
//#endif

            try
            {
                // Initialize the application configuration
                Program.AppConfig = new AppConfig(true);

                // Parse the startup arguments, and apply them to the configuration
                AppConfigParameterParser.Parse(args, Program.AppConfig);

                // Set up a new webhost
                var host = new WebHostBuilder()
                           .UseKestrel()
                           .UseContentRoot(Directory.GetCurrentDirectory())
                           .UseIISIntegration()
                           .UseStartup <Startup>()
                           .Build();

                // Run the actual web host
                host.Run();
            }
            catch (Exception ex)
            {
                // Print the exception
                Console.WriteLine(ex);

                // Show a warning
                Console.WriteLine(
                    "\n\nAn unrecorerable exception occurred.\nThe application will not quit (code: -1).");

                // Exit
                Environment.Exit(-1);
            }
        }