Environment configurations with episerver cms 11.20.12 not working as expected

Vote:
 

Hello,

We added code from this document https://world.optimizely.com/documentation/developer-guides/archive/dxp-cloud-services/development-considerations/environment-configurations/ to know the environment during runtime and act according but that's not working as expected. Just to test if we change the environment name from Azure App Service it's not working as expected.

private static bool GetAzureEnvironmentConfiguration()

        {

            var appSettings = ConfigurationManager.AppSettings;

            var environmentName = appSettings["episerver:EnvironmentName"];

            bool isIntegrationOrPreproduction = false;

            if (environmentName == null || environmentName.Equals("Integration") || environmentName.Equals("Preproduction"))

            {

                isIntegrationOrPreproduction = true;

            }

            return isIntegrationOrPreproduction;

        }

This means code can't integrate with Azure app service during run time? Can anybody help with this issue.

Thanks,

Deepa

#285289
Aug 10, 2022 6:32
Vote:
 

Did you add the episerver:EnvironmentName keys to each of your Integration, Preproduction and Production web configs?

#285343
Aug 11, 2022 1:29
Vote:
 

Yes we have it for all the three environments.

#285347
Aug 11, 2022 4:25
Vote:
 

DId you try to debug to see which value environmentName has? Perhaps it's case sensitivity issue? 

#285349
Aug 11, 2022 9:43
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.