In the ASP.NET Core Main method below, how can I determine the hosting environment, so I can switch between different certificate files for HTTPS?
public sealed class Program
{
public static void Main(string[] args)
{
new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseKestrel(
options =>
{
if ([Development Hosting Environment])
{
options.UseHttps("DevelopmentCertificate.pfx");
}
else
{
options.UseHttps("ProductionCertificate.pfx");
}
})
.UseIISIntegration()
.UseStartup<Startup>()
.Build()
.Run();
}
}
Update
I raised the following GitHub issue.