How ASP. NET Core sets environment variables in IIS

Source: Internet
Author: User

When running an ASP. NET Core application, Webhostbuilder determines which environment is currently running, possibly development,staging or production, based on the environment variables. You can also set it to a random string.

This link will show you how to set environment variables in various environments of various platforms. But if you use IIS to proxy ASP. You need to set environment variables in Web. config

<Configuration>  <system.webserver>    <handlers>      <Addname= "Aspnetcore"Path="*"verb="*"Modules= "Aspnetcoremodule"ResourceType= "Unspecified"/>    </handlers>    <AspnetcoreProcesspath= "%launcher_path%"arguments= "%launcher_args%"stdoutlogenabled= "true"Stdoutlogfile= ". \logs\stdout"Forwardwindowsauthtoken= "false">      <Environmentvariables>        <environmentvariablename= "Aspnetcore_environment"value= "Development" />      </Environmentvariables>    </Aspnetcore>  </system.webserver></Configuration>

You need to add the following to the Web. config

< Environmentvariables >        <  name= "Aspnetcore_environment"  value= "Development"/>      </environmentvariables>

How ASP. NET Core sets environment variables in IIS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.