Multi-environment configuration .net core of

Reference Address: https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/environments?view=aspnetcore-2.2

Official website said that the environment can be configured as three values: Development , Staging  and  Production's .

Our project is the default Development . When you configure multiple environmental tests do not always go and change the connection to the test, only need to configure it, and then select the item to configure and run the project will be able to connect to a different environment, very comfortable what.

 

① View

 

Property right of your project, commissioning found:

 

 ② create a new environment:

 

③ start of the seats, the more you create an environment

 

 

 ④ add appsettings.xx.json file, copy it to the names on the list, which is the main configuration parameters

 ⑤ then run your project, every time to read the documents are appsettings value of your environment 

 

 

Note: We CSS, JS, and code on the page on a page can be loaded depending on the environment

 

Guess you like

Origin www.cnblogs.com/Sea1ee/p/11129351.html
Recommended