{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:32462",
"sslPort": 44348
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"WebApplication1": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
ASPNETCORE_ENVIRONMENT--环境配置方式,默认为开发环境
ASPNETCORE_ENVIRONMENT常见方式三种,也可进行自定义,例如Demo方式...
//env.IsDevelopment 开发环境
//env.IsProduction 生成环境
//env.IsStaging 预览
//env.IsEnvironment(demo) 可理解为自定义方式
"ASPNETCORE_ENVIRONMENT": "Development"
注:默认启动Startup.cs中
public void ConfigureServices(IServiceCollection services)
如果将"ASPNETCORE_ENVIRONMENT": "Demo"
则启动——约定方式哦
public void ConfigureDemoServices(IServiceCollection services)
如下所示:

注:如果找不到对应的ConfigureDemoServices,则启动ConfigureServices