I have set <EnvironmentName>Development</EnvironmentName> and when published it has <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> in web.config but when running the application.exe it has no environment configured so defaults back to Production. Console.WriteLine($"{environment} - {JsonSerializer.Serialize(redisOptions)}"); => - xxxx (No Environment name is there)