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
- Development development Environment appsetting. Development.json
- Staging test Environment appsetting. Staging.json
Production production environment appsetting. Production.json
Note the point
- If no environment variable is set, it defaults to Appsetting.json.
- vs-> Project Properties-> Debug-> can add it, default is development, you can modify it as needed
- You can add environment variables for the system, and the effect is the same
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