Configuring the ASP.NET Core backend for staging and production
In this section, we are going to create separate appsettings.json
files for staging and production as well as for working locally in development. Let's open our backend project in Visual Studio and carry out the following steps:
- Let's now go to Solution Explorer, as illustrated in the following screenshot:
Notice that two settings files start with the word
appsettings
.Important Note
We can have different settings files for different environments. The
appsettings.json
file is the default settings file and can contain settings common to all environments.appsettings.Development.json
is used during development when we run the backend in Visual Studio and overrides any duplicate settings that are in theappsettings.json
file. The middle part of the filename needs to match an environment variable calledASPNETCORE_ENVIRONMENT
, which is set toDevelopment...