Net core multi environment publishing and deployment

Time:2022-5-31

1. new asp Net core project has Appsettings by default JSON and appsettings Development JSON,

Create a new production environment appsettings Production JSON

 

2. publish the configuration file to create a development test and a production environment. Pay attention to placing in different release directories

 

Two configuration files were generated:

 

Specify the deployment environment in each profile:

Test environment:

 

Production environment:

 

 

The above configuration will be automatically published on the web Add the configuration of the specified running environment to config

Test environment:

 

Production environment:

 

 

NETCORE runtime will automatically read the corresponding configuration file according to the above configuration. If there is no corresponding configuration in the corresponding configuration file, it will be displayed in the default appsettings JSON.