Home > Net >  Where are the EnvironmentVariablesConfigurationProvider fetching it's key-value pairs from?
Where are the EnvironmentVariablesConfigurationProvider fetching it's key-value pairs from?

Time:09-29

Background

I am working on an asp.net core application which uses Environment Variables to store connection strings to the database. I tried changing the connection string in windows to connect the application to another database, but the application still uses the old connection string. I even removed the connection string completely but the old one is still present while debugging. This screenshot shows that the EnvironmentVariablesConfigurationsProvider inside the Configuration variable still holds the old value on runtime (index 24, AzureConnectionString):

enter image description here

This screenshot shows the environment variables that I have set-up in Windows:

enter image description here

Question

As you can see when comparing both pictures, the AzureConnectionString key is not defined in the Environment Variables dialog in Windows, but somehow present in the application on runtime, which makes me think that these values are fetched elsewhere.

So to the question. Where are the EnvironmentVariablesConfigurationProvider fetching it's key-value pairs from?

CodePudding user response:

It seems the Environment Variables in the application is in fact built from the values seen in the Environment Variables dialog in windows. However there is also some kind of caching of said variables which I solved with a system reboot.

  • Related