public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)

        .ConfigureLogging((Logging) =>
        {
            Logging.AddDebug();
            Logging.AddConsole();
        })
        .UseStartup <Startup>();
Exemplo n.º 2
0
 public static IHostBuilder CreateHostBuilder(string[] args) =>
 Host.CreateDefaultBuilder(args).ConfigureLogging(Logging =>
 {
     Logging.ClearProviders();
     Logging.AddConsole();
 })
 .ConfigureWebHostDefaults(webBuilder =>
 {
     webBuilder.UseStartup <Startup>();
 });
Exemplo n.º 3
0
        public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)

        //todo: by k1
        .ConfigureLogging(Logging => {
            Logging.ClearProviders();
            Logging.AddConsole();
        })
        .ConfigureWebHostDefaults(webBuilder =>
        {
            //todo: by k1
            //webBuilder.UseStartup<MyStartup>();
            webBuilder.UseStartup <Startup>();
            //todo: by k1
            webBuilder.UseWebRoot("Public");
        });
Exemplo n.º 4
0
        public static IWebHostBuilder CreateHostBuilder(string[] args)
        {
            var buider = new WebHostBuilder()
                         .UseKestrel()
                         .UseStartup <Startup>()
                         .UseContentRoot(Directory.GetCurrentDirectory())
                         .ConfigureAppConfiguration((hostingContext, config) =>
            {
                var env = hostingContext.HostingEnvironment;
                config.AddJsonFile("appsettings.json", true, true)
                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, true);
                //if (env.IsDevelopment())
                //{
                //    var appAssembly = Assembly.Load(new AssemblyName(env.EnvironmentName));
                //    if (appAssembly != null)
                //    {
                //        config.AddUserSecrets(appAssembly, true);
                //    }
                //}
                config.AddEnvironmentVariables();
                if (args != null)
                {
                    config.AddCommandLine(args);
                }
            })
                         .ConfigureLogging((hostingContext, Logging) =>
            {
                Logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
                Logging.AddConsole();
                Logging.AddDebug();
            })
                         .UseIISIntegration()
                         .UseDefaultServiceProvider((Context, Options) =>
            {
                Options.ValidateScopes = Context.HostingEnvironment.IsDevelopment();
            });

            return(buider);
        }