Dotnetcore Cross-platform ~ recognize environment and environment variables

Source: Internet
Author: User

Back to Catalog

Environment

Environment, for development is the deployment of a scenario, you can be debug scenes, test scenarios, production scenarios, of course, there can be many other scenarios, as long as your project needs can be customized, Microsoft helped us define three standard environment variables, the following.

Default definition of three scenarios
    1. Development development Environment appsetting. Development.json
    2. Staging test Environment appsetting. Staging.json
    3. Production production environment appsetting. Production.json

      Note the point
    4. If no environment variable is set, it defaults to Appsetting.json.
    5. vs-> Project Properties-> Debug-> can add it, default is development, you can modify it as needed
    6. You can add environment variables for the system, and the effect is the same
    7. In Linux and Docker, you can also set Env to achieve the same effect

      Code Show
      {  "Logging": {"IncludeScopes": false,"LogLevel": {  "Default": "Debug",  "System": "Information",  "Microsoft": "Information"}  },  "ProjectName": "环境变量production",  "DapperConfig": {"DbType": 3,"ConnectionString": "Data Source=c:/Data/Db/intergratetest.db"  },  "RabbitMqOptions": {"MqServerHost": "47.94.99.69","ExchangeName": "tax","UserName": "tax","Password": "yougroup000!","VirtualHost": "tax","ExchangeType": "topic"  },  "RedisConfig": {"Host": "127.0.0.1:6379","Proxy": 0,"IsSentinel": 0,"ServiceName": "","AuthPassword": ""  }}

      Back to Catalog

Dotnetcore Cross-platform ~ recognize environment and environment variables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.