How to set ASP.NET 5 environment variables on production environment

前端 未结 2 1652
后悔当初
后悔当初 2021-01-12 08:07

In Visual Studio 2015 you set the following variable in project properties: ASPNET_ENV. If you set it to development then you can use:

publi         


        
2条回答
  •  死守一世寂寞
    2021-01-12 08:25

    This is how to set the environment variable on Windows:

    1. On your server, right click 'Computer' or 'My Computer' and click on 'Properties'.
    2. Go to 'Advanced System Settings'.
    3. Click on 'Environment Variables' in the Advanced tab.
    4. Add a new System Variable with the name ASPNET_ENV (RC1) or ASPNETCORE_ENVIRONMENT (RC2, RTM and Above) and a value of Production, Staging, Development or whatever you want.
    5. A reboot of your site may be required.

    See also this answer for how to read the environment variable from gulpfile.js.

提交回复
热议问题