Configuration

When we develop ASP.NET Core web apps, we will quickly realize that we need to change a few settings at runtime. To give an example, consider a web application that makes API calls to the service. When you develop the web app, the service is deployed in some development server and when you deploy it in production, the service URL is different, so the URL should not be hardcoded in the application. Instead, it should be read from the configuration, so that it can be changed without having to recompile the code. Another often used example is that of database connection strings, if the app makes use of them. This section takes a look at how we can accomplish this in ASP.NET Core.

The ASP.NET Core configuration model has three main ...

Get .NET Core 2.0 By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.