Instantly share code, notes, and snippets.

Embed
What would you like to do?
private static IWebHost CreateWebHost()
{
var scheme = Environment.GetEnvironmentVariable("SCHEME");
if (string.IsNullOrWhiteSpace(scheme))
{
scheme = "http";
}
var port = Environment.GetEnvironmentVariable("PORT");
if (string.IsNullOrWhiteSpace(port))
{
port = "5000";
}
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls($"{scheme}://0.0.0.0:{port}")
.Build();
return host;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment