I got the following error today: ‘ConfigurationSettingSubscriber needs to be set before FromConfigurationSetting can be used”
I don’t claim to understand the physics behind this error, but it’s really kind of stupid.
It seems you may be get this error when developing with the Azure SDK (yes, even the November CTP); more specifically when dealing with the retrieval of configuration settings:
How do you fix it?
Go to the ASP.NET application project for the web role, open up the role entry point class (the class file holding the WebRole class for this project), and insert the following into the OnStart() method body:
1: CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
2: {
3: configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
4: RoleEnvironment.Changed += (sender, arg) =>
5: {
6: if (arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>()
7: .Any((change) => (change.ConfigurationSettingName == configName)))
8: {
9: if (!configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)))
10: {
11: RoleEnvironment.RequestRecycle();
12: }
13: }
14: };
15: });
All should be well with the world. Don’t ask.