What are the sequence of events that occur when I make changes to the settings file (ServiceConfiguration.Cloud.cscfg) for an cloud deployed App? Will the worker roles restart so that the new changes are reflected? (Will the OnStop, OnStart, Run events be trigerred on changing the settings value?)
In my cloud service, I read the custom values from the configuration file in the Run() method of the WorkerRole and wondering if any change to ServiceConfiguration.Cloud.cscfg file for an app deployed in the cloud will re-trigger the OnStart and Run events?
Yes indeed, your instances will go through OnStop / (Reboot) / OnStart / Run after each configuration change. If you’re storing the settings in your application in a static variable for example it might be a good thing to let this happen. This way, after the reboot your application will restart and it will get a chance to re-initialize all settings in the static variables.
Now on the other hand, if you want the instance to reboot you can handle this change yourself (maybe you cached the settings somewhere, or iniitalized a static object without those settings). You’ll need to trigger the reboot by handling the RoleEnvironment.Changing event :