-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net Core App Configuration Dynamic Configuration doesn't refresh array values #357
Comments
Hi willyt150 , defining arrays using index is fine in Asp.net core. So for items like Key:Subkey:0
It will bind to the object
|
Thanks @shenmuxiaosen, sorry yes I know that approach works great. My issue is that if I go that approach and I change the value of one of those items or add another item (Key:Subkey:3), in the Azure App Configuration, it doesn't refresh the values of the Key class. I have to restart the App Service hosting the site for it to get those new values. However, if the setting is NOT an array (e.g. Key:Subkey) changing that value in the Azure App Configuration, and changing the sentinel value, will refresh without any problem. |
@willyt150 Could you share the code snippet that you used to configure App Configuration? |
@abhilasharora sure thing In the Program.cs inside the config.AddAzureAppConfiguration(options =>
{
options.Connect(azureAppConfigurationConnectionString)
.UseFeatureFlags()
.ConfigureRefresh(configure =>
{
configure.Register(GlobalConstants.SentinelKey, refreshAll: true);
});
}); And I call the |
An object |
Oh... That makes sense. I guess when I was confirming that the changes had refreshed I was looking at the IConfiguration. Ok, I'll give those a try tomorrow. Thank you! |
Thank you @abhilasharora The IOptionsMonitor was what I was looking for and worked like a charm. |
Hello,
This is for an Asp.net core 3.1 project using Microsoft.Extensions.Configuration.AzureAppConfiguration 3.0.1.
I mimicked the Tutorial: Use dynamic configuration in an ASP.NET Core app and when I change the "Sentinel" value along with non-array values in the Azure App Configuration portal, I almost immediately see the change.
However, when I change an array value, or attempt to add another entry in the array, in the portal and then change the "Sentinel" value, nothing happens. I have to completely restart my site to see the update.
I'm defining the arrays like this in the portal:
Key:Subkey:0
Key:Subkey:1
Key:Subkey:2
This closed issue for Support single-value arrays shows being able to specify an array in the portal as Key:Subkey (without the indexing) and specify an actual array as the value ["val1", "val2", etc...].
I tried this approach thinking maybe that would solve my issue and I was able to confirm that it did refresh, however going this approach doesn't bind the array to the appropriate property when I use IOptions.
Or do I need to treat that array config value as a string and have my Options class convert it into an array like in this comment in issue #242
Thanks!
The text was updated successfully, but these errors were encountered: