Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

First class Configuration and Logging in WebHostBuilder #955

Closed
@glennc

Description

@glennc

We want to enable the following program main:

public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseConfiguration((configBuilder, env) => 
                {
                    configBuilder.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                                 .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                                 .AddEnvironmentVariables()
                                 .AddCommandLine(args);
                })
                .UseLogging((factory, config) =>
                {
                    factory.AddFilter(config.GetSection("Logging"));
                    factory.AddConsole();
                    factory.AddDebug();
                })
                .UseIISIntegration()
                .UseStartup<Startup>()
                .UseKestrel()
                .Build();

            host.Run();
        }

This issue is to track the WebHostBuilder part of this.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions