官术网_书友最值得收藏!

Different startups for different environments

Applications run in different environments, such as development, staging, and deployment:

  • Development environment: Where developers run their freshly written code; this is usually their own machine.
  • Staging environment: An environment similar to the production environment, but not open to the public. Used to test the application on similar conditions as the production environment.
  • Production environment: Where the application runs publicly, usually on the cloud or a hosting company.

Every environment has a different set of configurations — for example, in development, logging will be set to verbose mode, meaning that all logs should be written, while in production, logging will be set to warning mode, so only warnings and errors will be logged.

ASP.NET Core supports supplying different Startup classes for each environment. To do this, you can create different classes with names following the convention of Startup{Environment Name}. For example, StartupDevelopment will run under the development environment and StatupProduction will run under the production environment.

The current environment is set via the ASPNETCORE_ENVIRONMENT environment variable, which you can change based on the environment you run on - Development, Testing, Production and so on.

主站蜘蛛池模板: 如东县| 定安县| 龙游县| 武乡县| 康乐县| 灵石县| 东光县| 栾城县| 东山县| 潮安县| 灵台县| 西安市| 开远市| 西吉县| 冕宁县| 庆云县| 克东县| 道孚县| 虞城县| 京山县| 贵溪市| 尚义县| 昆明市| 高邮市| 陆良县| 海阳市| 隆尧县| 峡江县| 潮州市| 长沙县| 隆安县| 五指山市| 彰化县| 噶尔县| 寿光市| 崇仁县| 渭南市| 剑阁县| 富源县| 三原县| 昆明市|