title: Unable to change listening port via environment variables with ASP.NET Core 2.0
body: <p>In my ASP.NET Core 2.0 application my web-host ist built like this:</p>
  
  <pre><code>public static IWebHost BuildWebHost(string[] args) =&gt;
      WebHost.CreateDefaultBuilder(args)
          .UseStartup&lt;Startup&gt;()
          .UseNLog()
          .UseUrls("http://*:5000")
          .Build();
  </code></pre>
  
  <p>I tried to override the listenting port by setting the environment variable:</p>
  
  <pre><code>SET ASPNETCORE_URLS=http://*:5001
  </code></pre>
  
  <p>But on startup my application still says</p>
  
  <pre><code>Now listening on: http://[::]:5000
  </code></pre>
  
  <p>I also tried to explicitly include environment variables as configuration source like this:</p>
  
  <pre><code>public static IWebHost BuildWebHost(string[] args) =&gt;
      WebHost.CreateDefaultBuilder(args)
          .UseStartup&lt;Startup&gt;()
          .UseNLog()
          .UseUrls("http://*:5000")
          .UseConfiguration(new ConfigurationBuilder().AddEnvironmentVariables().Build())
          .Build();
  </code></pre>
  
  <p>But it doesn't work either.</p>
  
  <p>So how can I make the listening port configurable via environment variables (and still provide a hardcoded default)?</p>