Created
May 1, 2021 09:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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