The azure role setting, is very useful since it lets you change values on-the-fly while IIS is running. But the problem is, if you have plenty users, and if it reads every time the config value from file, it is not best practice to use it without putting it in a static variable. The next problem, if you put it in a static variable, then you have to reset IIS every time you change it. I did some research, and found similar question on stackoverflow, which tells that only first time reads conf on file, then it stores it on cache. But that question which was answered was for ConfigurationManager, mine is about RoleManager from Azure.
This is the line which gets the current setting on azure:
RoleEnvironment.GetConfigurationSettingValue("Appname.settingKey");
This is the one that saves it in cache, which I know how it works, and gets current setting ex.: connectionstring in webconfig:
ConfigurationManager.ConnectionStrings["SettingKey"].ConnectionString;
https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.serviceruntime.roleenvironment.changed.aspx Here is the link for changed.
If you follow the types down you can get to: https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.serviceruntime.roleenvironmentchange.aspx
which is the type sent to the Changed event for changes in general.
Specifically here is the configuration value update: https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.serviceruntime.roleenvironmentconfigurationsettingchange.aspx
This lists the settings that were changed. Note that it does NOT include the values that changed, just the names of the settings, this is because the Changed event also resets the configuration cache so you read from it again since the changes happened.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With