How to set environment variable asp.net core 5.0?
Local application is working fine because it have launchsetting and reading environment varible from launchsettings.
after deployed to production environment variable is null.
how to fix it. In production I set environment variable through control panel advanced setting environment variable I added. Is there any way how it fix it

Vishal YelveRank #178 · 13.6K reputationPosted Nov 22, 2022, 12:46 AM EST
Please check below links
https://github.com/dotnet/aspnetcore/issues/1864
https://andrewlock.net/why-isnt-my-asp-net-core-environment-specific-configuration-loading/
https://stackoverflow.com/questions/46955538/launchsettings-json-appsettings-json-web-config
Jignesh KumarRank #91 · 22.9K reputationPosted Nov 22, 2022, 1:09 AM EST
Hi Kavya,
// Set Environment variable
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-7.0
https://andrewlock.net/how-to-set-the-hosting-environment-in-asp-net-core/
//Read Environment Valriable
https://stackoverflow.com/questions/44437325/access-environment-name-in-program-main-in-asp-net-core
Naresh BeniwalRank #365 · 6.8K reputationPosted Nov 22, 2022, 1:27 AM EST
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-7.0
Aravind GovindarajRank #430 · 5.8K reputationPosted Nov 22, 2022, 3:25 PM EST
Usually, the environment variables are set it up in the deployment pipeline. Whenever you do debugging on the local machine, you set all required variables in your configuration file, however if you doing deployment in server then all the variables are derived from deplyoment pipeline code, because the variables are not constant it may change environmen to environment.