Exemple #1
0
 public static void Main(string[] args)
 {
     if (AngularGenerator.ShouldRunMvc(args))
     {
         BuildWebHost(args).Run();
     }
 }
Exemple #2
0
        public static void Main(string[] args)
        {
            if (AngularGenerator.ShouldRunMvc(args))
            {
                var logger = GetLogger();
                try
                {
                    logger.Information($"VsExample.AspAPI Startup: {string.Join(", ", args)}");

                    var desiredEnvironment = args.GetParameter("--env", "-e");
                    if (!string.IsNullOrWhiteSpace(desiredEnvironment))
                    {
                        Environment.SetEnvironmentVariable(ASPNETCORE_ENVIRONMENT, desiredEnvironment);
                    }

                    var desiredUrls = args.GetParameter("--urls", "-l");
                    if (!string.IsNullOrWhiteSpace(desiredUrls))
                    {
                        Environment.SetEnvironmentVariable(ASPNETCORE_URLS, desiredUrls);
                    }

                    var environment = Environment.GetEnvironmentVariable(ASPNETCORE_ENVIRONMENT);
                    logger.Information($"VsExample.AspAPI ASPNETCORE_ENVIRONMENT: {environment}");

                    var urls = Environment.GetEnvironmentVariable(ASPNETCORE_URLS);
                    logger.Information($"VsExample.AspAPI ASPNETCORE_URLS: {urls}");

                    CreateWebHostBuilder(args).Build().Run();
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "Error of MVC");
                }
            }
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            if (AngularGenerator.ShouldRunMvc(args))
            {
                var isDevelopment = (Debugger.IsAttached || args.Contains("--development"));
                var builder       = CreateWebHostBuilder(
                    args.Where(arg => arg != "--console" && arg != "--development").ToArray(),
                    isDevelopment ? "https://*:9188;http://*:9186" : "https://*:443;http://*:80"); //

                // to run this console app as a windows service:

                /*
                 *
                 * NSSM is the tool to set up windows service for any console app.
                 *
                 * http://nssm.cc/usage
                 *
                 * In Ubuntu Linux, a service could be any console app. In Windows, a wrapper is required.
                 *
                 * 1. Download and extrace the NSSM to any folder.
                 * 2. Run the “nssm install <service name>” to create you service.
                 * 3. Make sure in the “Log On” tab, put your administrator username and password. Otherwise, the console app may not run properly. (In my case, the web service is not working without logon.).
                 *
                 */

                var host = builder.Build();
                host.Run();
            }
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            // --generate-angular -o \"D:\VSTS\Repos\Machine Learning Lecture\Projects\Seek\SeekUI\src\app\services\mvc-api\" -a \"SeekAPI;JobModel\"
            //
            //
            //
            //args = new string[] {
            //    @"--generate-angular",
            //    "-o",
            //    @"D:\VSTS\Repos\Machine Learning Lecture\Projects\Seek\SeekUI\src\app\services\mvc-api\",
            //    "-a",
            //    "SeekAPI;JobModel"
            //};

            //Console.WriteLine($"Arguments: {string.Join(" ", args)}");
            if (AngularGenerator.ShouldRunMvc(args))
            {
                BuildWebHost(args).Run();
            }
        }