Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseIISIntegration()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((context, configBuilder) =>
{
configBuilder
.SetBasePath(context.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configBuilder.Build())
.CreateLogger();
})
.ConfigureLogging((context, loggingBuilder) =>
{
loggingBuilder.AddSerilog(dispose: true);
})
.Build();
host.Run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment