Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") to get the application setting should work on the Azure WebApp. I assume that value is overridden by other codes.
You could debug it with following way.
1.Check the staging kudu(https://yousitename-staging.scm.azurewebsites.net/Env.cshtml) to check environment variable ASPNETCORE_ENVIRONMENT.
2.We also could remote debug slot with VS.
The following is my test steps:
1.Create a .net core project.
2.Create a slot for an existing Webpp and appsetting for slot
3.Check the environment variable with kudu tool
4.Add the following code in the index.chtml.cs file
var appsetting = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
ViewData["appseting"] = appsetting;
5.in the index.chtml file change the title to appsetting value
@page
@model IndexModel
@{
ViewData["Title"] = ViewData["appseting"];
}
6.Publish the WebApp to Azure with debug mode
7.Check the title of the home page.
we also could remote debug to check it.
