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.
However, developing conditional code that uses different components based on different deployment environments and configurations, seems to be complicated at first. In traditional applications, you must create a lot of code to handle all of the different...