title: asp.net 5 (mvc6 configuration) not reading from appsettings.json
body: <p>appsettings.json</p>
  
  <pre><code>{
  "Logging": {
  "IncludeScopes": false,
  "LogLevel": {
    "Default": "Verbose",
    "System": "Information",
    "Microsoft": "Information"
  },
  "CustomSettings": {
    "UseDataCaching": true
    }
   }
  }
  </code></pre>
  
  <p>option class</p>
  
  <pre><code>public class CustomSettings
  {
      public bool UseDataCaching { get; set; }
  }
  </code></pre>
  
  <p>startup.cs</p>
  
  <pre><code> public void ConfigureServices(IServiceCollection services)
      {
          ...
          services.AddOptions();
          services.Configure&lt;CustomSettings&gt;(Configuration);
          ...
      }
  
      public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
      {
          // Set up configuration sources.
  
          var builder = new ConfigurationBuilder()
              .SetBasePath(appEnv.ApplicationBasePath)
              .AddJsonFile("appsettings.json")
              .AddEnvironmentVariables()
              .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
  
          if (env.IsDevelopment())
          {
              // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
              builder.AddUserSecrets();
  
              // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
              builder.AddApplicationInsightsSettings(developerMode: true);
          }
  
          builder.AddEnvironmentVariables();
          Configuration = builder.Build();
      }
  </code></pre>
  
  <p>controller</p>
  
  <pre><code> protected IMemoryCache MemoryCache { get; }
      protected IOptions&lt;CustomSettings&gt; CustomSettings { get; set; }
      public HomeController(IMemoryCache cache, IOptions&lt;CustomSettings&gt; customSettings)
      {
  
          MemoryCache = cache;
          CustomSettings = customSettings;
      }
  </code></pre>
  
  <p>customSettings.Value.UseDataCaching is always false even though in appsettings.json i have set it to true.</p>
  
  <p>Not sure if i missed something very obvious</p>
  
  <p>EDIT: added startup constructor</p>
  
  <p>USAGE:</p>
  
  <pre><code>     public IActionResult About()
      {
          var isUsingDataCache = CustomSettings.Value.UseDataCaching;
          ViewData["Message"] = "Your application description page.";
  
          return View();
      }
  </code></pre>
  
  <p>EDIT: changed the startup to take 2 params</p>
  
  <p><strong>SAMPLE PROJECT DOES NOT WORK</strong>
  <a href="http://www.megafileupload.com/a2hn/WebApplication1.zip" rel="nofollow">http://www.megafileupload.com/a2hn/WebApplication1.zip</a></p>