Environment variables in IIS

From Logic Wiki
Jump to: navigation, search


  • Go to your application in IIS and choose Configuration Editor.
  • Select Configuration Editor
  • Choose system.webServer/aspNetCore (RC2 and RTM) or system.webServer/httpPlatform (RC1) in Section combobox
    • web.config writes variable in web.config file but Application Host.config keeps it out. It's safer because it'll not be overwritten
  • Choose Applicationhost.config ... in From combobox.
  • Right click on enviromentVariables element, select 'environmentVariables' element, then Edit Items.
  • Set your environment variables. - ASPNETCORE_ENVIRONMENT
  • Close the window and click Apply.
  • Done


Global

  • Search and open Environment Variables
  • In the System Properties window, click on the Environment Variables button.
  • In the Environment Variables window, you will see two sections: User variables (for the current user) and System variables (for all users).
  • Click on the New button to add a new variable, or Edit to modify an existing one.
  • Enter the Variable name and Variable value.
  • Save and Apply:
  • Click OK to save the changes, and then OK again to close the System Properties window.
  • Restart IIS:
    • Open a Command Prompt with administrative privileges and run the following command to
iisreset