public static IWebHostBuilder CreateWebHostBuilder() { IWebHostBuilder builder = new WebHostBuilder(); _appOptions = Configuration.Get <ApplicationOptions>(); Log.Debug("Configuration used: {@configuration}", _appOptions); if (_appOptions.Host.UseIis) { builder.UseIISIntegration(); } builder .SuppressStatusMessages(true) .UseKestrel((options) => Configuration.GetSection(nameof(ApplicationOptions.Kestrel))) .UseContentRoot(Directory.GetCurrentDirectory()) .UseConfiguration(Configuration) .ConfigureServices(services => services.AddCors().AddRouting()) .UseDefaultServiceProvider((context, options) => options.ValidateScopes = context.HostingEnvironment.IsDevelopment()) .Configure(ConfigureApp); return(builder); }