Skip to content

Instantly share code, notes, and snippets.

@snluu
Created April 9, 2017 17:11
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 snluu/d05732e1b7eb0c98660f5dc10c606c76 to your computer and use it in GitHub Desktop.
Save snluu/d05732e1b7eb0c98660f5dc10c606c76 to your computer and use it in GitHub Desktop.
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