How and where to define an environment variable on Azure

后端 未结 6 2286
臣服心动
臣服心动 2020-11-27 15:38

I have an ASP.NET MVC web application deployed to Azure. I\'m reading my setting using the GetEnvironmentVariable(...) method.

The problem is that I can

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-27 16:01

    I came across this question when facing the same problem myself. Well, just to give a clearer answer which I found at blog.elmah.io.

    All you need to do is:

    1. Include the new appsetting.{env}.json in the publishOptions in file project.json.
    2. Go to Azure Portal and open the web application.
    3. Select application settings.
    4. Add an entry for ASPNETCORE_ENVIRONMENT and set it to whatever you want.

    That's it.

提交回复
热议问题