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

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.

主站蜘蛛池模板: 阳春市| 大同市| 建水县| 白沙| 甘谷县| 宁夏| 吉林省| 济宁市| 昌邑市| 平泉县| 太白县| 犍为县| 徐州市| 长治县| 蕲春县| 静海县| 千阳县| 杭锦后旗| 驻马店市| 双辽市| 息烽县| 龙岩市| 尼玛县| 阿巴嘎旗| 平顶山市| 嫩江县| 临夏市| 南京市| 昂仁县| 宝应县| 南宁市| 旬邑县| 宁德市| 嘉祥县| 拜城县| 班玛县| 河津市| 保德县| 兴化市| 浪卡子县| 磐安县|