Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created May 1, 2021 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/3288e68d637285013cf345b2396de3dc to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/3288e68d637285013cf345b2396de3dc to your computer and use it in GitHub Desktop.
applying the host settings to the web host in C# .NET application
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseEnvironment("SomeEnvironmentName");
webBuilder.UseContentRoot(Directory.GetCurrentDirectory());
webBuilder.UseWebRoot("C:\\SecuredPath\\WebRoot\\");
webBuilder.UseStartup<Startup>();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment