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

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.

主站蜘蛛池模板: 宜川县| 米脂县| 德庆县| 溧阳市| 甘南县| 子洲县| 苏尼特右旗| 邵东县| 汉沽区| 泉州市| 客服| 牟定县| 稻城县| 永寿县| 永善县| 威海市| 通海县| 桃江县| 松桃| 双鸭山市| 靖边县| 延寿县| 雷州市| 留坝县| 镇赉县| 丘北县| 华亭县| 精河县| 茶陵县| 绵阳市| 南丹县| 雅江县| 海丰县| 衡阳县| 乐平市| 通城县| 华安县| 长子县| 丰原市| 高雄县| 六枝特区|