在ASPNETCORE_ENVIRONMENT
launchsettings.json
环境变量之间的区别是什么
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55556/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Departures": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5001/"
}
}
}
并运行配置?
似乎都没有对应用程序实际使用的内容产生影响。
此帖子(Is launchSettings.json used when running ASP.NET 5 apps from the command line on Mac?)表明设置ASPNETCORE_ENVIRONMENT
值的正确方法是通过命令行。
问题:
ASPNETCORE_ENVIRONMENT
值的“正确”方式是什么?Microsoft.AspNetCore.Hosting.IHostingEnvironment.EnvironmentName
)中显示吗?Application settings
部分正确设置ASPNETCORE_ENVIRONMENT
值吗?