1、Windows

直接右键计算机手动添加环境变量。
新增系统变量 ASPNETCORE_ENVIRONMEN

2、Linux

export ASPNETCORE_ENVIRONMEN='Production'

3、docker

docker 配置在启动容器时加上-e参数

docker run -d -e ASPNETCORE_ENVIRONMEN=Production --name containerName testImage