Building once and running on multiple environments

After building your applications, you have to think about deploying them to different environments. As you have already seen in the previous section on configuration, you can use configuration files for changing the configuration of your services and even your application.

In the case of multiple environments, you have to duplicate the appsettings.json file for each environment and name it accordingly, appsettings.{EnvironmentName}.json.

ASP.NET Core 2.0 will automatically retrieve the configuration settings in hierarchical order, first from the common appsettings.json file and then from the corresponding appsettings.{EnvironmentName}.json file, while adding or replacing values if necessary. ...

Get Learning ASP.NET Core 2.0 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.