public static void Main(string[] args) { var config = new ConfigurationBuilder() .AddCommandLine(args) .AddEnvironmentVariables(prefix: "ASPNETCORE_") .Build(); var builder = new WebHostBuilder() .UseConfiguration(config) .UseIISIntegration() .UseStartup("MusicStore.Web"); if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)) { var environment = builder.GetSetting("environment") ?? Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); if (string.Equals(environment, "NtlmAuthentication", System.StringComparison.Ordinal)) { // Set up NTLM authentication for WebListener like below. // For IIS and IISExpress: Use inetmgr to setup NTLM authentication on the application vDir or // modify the applicationHost.config to enable NTLM. builder.UseWebListener(options => { options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.NTLM; options.ListenerSettings.Authentication.AllowAnonymous = false; }); } else { builder.UseWebListener(); } } else { builder.UseKestrel(); } var host = builder.Build(); host.Run(); }