From the course: Learning ASP.NET Core MVC

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Populate configuration settings

Populate configuration settings

From the course: Learning ASP.NET Core MVC

Populate configuration settings

- [Instructor] Now that I've shown you the basics of the configuration API using environment variables, I'll show you how to configure your application using a configuration file, you might have noticed that one of the very few files that Visual Studio created for me when I created the project, was this file, named appsettings.JSON. As the file extension indicates, the contents of this file are just one big JSON object. Which I can use to set whatever configuration values I like, that means if I wanted to set that configuration setting, enable developer exceptions from a configuration file instead of from an environment variable, I can simply define it as a property like this. With this in place I can now run the site, and then step through my breakpoint to see that the value of enable developer exceptions, is true. Now if you think that's as cool as I do, you'll love this part. The configuration API also allows you to read complex JSON objects, in other words I can update the JSON…

Contents