You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Configuration refresh does not work when ChainedConfigurationProvider is used #168
A user added the App Configuration middleware to their application, but the configuration is not refreshed.
Cause
The AzureAppConfigurationProvider could be nested under a ChainedConfigurationProvider if the user calls IConfigurationBulder.AddConfiguration(...) to add configuration built from the App Configuration provider.
Unfortunately, ChainedConfigurationProvider does not provide a way for others to access its child providers. This caused the issue that the App Configuration middleware could not find the instance of AzureAppConfigurationProvider and thus cannot obtain the instance of IConfigurationRefresher.
Proposal
There is no good solution to this. One idea from Drago Draganov (@drago-draganov) is we provide an alternative API for users to call (the name is to be finalized)
This is not a viable solution in .NET 6 as the user is not the one calling IConfigurationBulder.AddConfiguration. The framework uses ChainedConfigurationProvider by default.
I also can't get the refresh to work with .NET 7 RC2 and the new minimal API-style Program.cs. I also have a ChainedConfigurationProvider in my list of providers:
Please add App Configuration provider directly to your configuration builder instead of nested under the ChainedConfigurationProvider. Here is a code sample for .NET 6.
Is this a web app? If so, you should also add App Configuration middleware as instructed in the same document. It will take care of the configuration refresh.
I'm so sorry, I seem to have just stopped reading after the step to add builder.Services.AddAzureAppConfiguration() and I haven't added the middleware. One shouldn't program late at night 😪
thank you very much for your help, it is working now.
Activity
zhenlan commentedon Oct 15, 2021
This is not a viable solution in .NET 6 as the user is not the one calling
IConfigurationBulder.AddConfiguration. The framework usesChainedConfigurationProviderby default.cwe1ss commentedon Oct 13, 2022
I also can't get the refresh to work with .NET 7 RC2 and the new minimal API-style Program.cs. I also have a
ChainedConfigurationProviderin my list of providers:Is there any workaround for this?
zhenlan commentedon Oct 13, 2022
Please add App Configuration provider directly to your configuration builder instead of nested under the
ChainedConfigurationProvider. Here is a code sample for .NET 6.https://learn.microsoft.com/en-us/azure/azure-app-configuration/enable-dynamic-configuration-aspnet-core?tabs=core6x#reload-data-from-app-configuration
cwe1ss commentedon Oct 13, 2022
Thank you for the quick response! I have been using that link for my implementation.
I did some more quick testing and the

ChainedConfigurationProvideris already there from the beginning:And here's how it looks after

AddAzureAppConfiguration():The
AzureAppConfigurationProviderhas been added to the list and isn't a child ofChainedConfigurationProvider.Anything else I can do?
zhenlan commentedon Oct 13, 2022
Is this a web app? If so, you should also add App Configuration middleware as instructed in the same document. It will take care of the configuration refresh.
If it's a console app, you will need to call
TryRefreshAsyncin your code to get the configuration refreshed. You can find more details in this doc for a console app.https://learn.microsoft.com/en-us/azure/azure-app-configuration/enable-dynamic-configuration-dotnet-core
cwe1ss commentedon Oct 14, 2022
I'm so sorry, I seem to have just stopped reading after the step to add
builder.Services.AddAzureAppConfiguration()and I haven't added the middleware. One shouldn't program late at night 😪thank you very much for your help, it is working now.
kevinferretti commentedon Oct 24, 2022
Now that the
ChainedConfigurationProviderexposes itsIConfigurationas per dotnet/runtime#44486, is this issue able to be fixed?zhenlan commentedon Oct 24, 2022
Yes, but that's only available in .NET 7.
Avani Gupta (@avanigupta), we need to code this so it will "light up" when running in a .NET 7 app.