Why Startup's IConfigurationRoot is null?
<p>I'm trying to pass command line arguments to <code>Startup</code> class. Following <a href="https://stackoverflow.com/questions/34212765/how-do-i-get-the-kestrel-web-server-to-listen-to-non-localhost-requests/34221690#34221690">this</a> example, I modified my <code>Program</code> class and it looks like this:</p>

<pre><code>        var builder = new ConfigurationBuilder()
            .SetBasePath(Directory.GetCurrentDirectory())
            .AddJsonFile("generalsettings.json", optional: false, reloadOnChange: true)
            .AddEnvironmentVariables(prefix: "ASPNETCORE_")
            .AddCommandLine(args);  
        var config = builder.Build();

        var host = new WebHostBuilder()
            .UseUrls("http://*:5000")
            .UseConfiguration(config)
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration()
            .UseStartup&lt;Startup&gt;()
            .Build();

        host.Run();
</code></pre>

<p><code>generalsettings.json</code> contains following data:</p>

<pre><code>{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}
</code></pre>

<p>Therefore I commented out default <code>Startup</code> class' constructor. Then I noticed that that's where <code>IConfigurationRoot Configuration</code> is assigned, and therefore, when I'm trying to use it from <code>ConfigureServices</code> it's null. I'm trying to use (I think) configuration built in <code>Program</code>'s <code>Main</code>. What am I missing here?</p>

<p><strong>UPDATE</strong></p>

<p>To make it clear: I'm trying to use <code>args</code> in <code>Startup</code> class.</p>