I am guessing it is creating a second .csfg file, but the config thing is hardwired into the Azure project type so I'm not really sure.
For example, if I wish staging and live to point at different sql-azure databases, how do I go about it?
Thanks
I am guessing it is creating a second .csfg file, but the config thing is hardwired into the Azure project type so I'm not really sure.
For example, if I wish staging and live to point at different sql-azure databases, how do I go about it?
Thanks
Assuming you want to the ability to make changes on the fly, almost like modifying a web.config and cycling an app pool in IIS, using multiple Service Configuration (.cscfg) files is the best approach.
Azure allows you (using both the Portal, and the Service Runtime API) to change the service configuration on-the-fly. You can design your application to respond to this, and have full control of the behavior based on the changes you apply.
To implement this you'd need to do two things:
(1) Migrate the settings you want the ability to change at runtime from a traditional app or web.config, to the .cscfg. (Declared in the Service Definition (.csdef))
(2) Hook the event handler(s) for environment changes
using Microsoft.WindowsAzure.ServiceRuntime;
// fired when a change is detected, prior to it being applied
RoleEnvironment.Changing += RoleChanging;
// fired when a change is completed, after its applied
RoleEnvironment.Changed += RoleChanged;
From there you can decide if you want to simply re-instantiate certain objects using the new variables, or take more drastic action such as recycling the role.