Sunday, 9 November 2008

Azure: Why can't I use appSettings

I have to admit I didn't get the point of this at all, until this afternoon.  It's one of these experience things.

So during the PDC (obviously didn't pay enough attention), I took note that in the world of Azure, we were to using the new ConfigurationSettings section instead of appSettings.  Ok I thought, but Why??

Why appSettings are no good?

I thought I'd try a sample that used appSettings, to see if threw up an exception.  I discovered that both in the "Development Fabric" and in "The Fabric", I had no problem using appSettings, so why was I supposed to use this new ConfigurationSettings section, and use the RoleManager to access it?

The answer is pretty simple it turns out, it comes down to changing the appSettings at runtime.

Guess what, you have no access to your web.config / appSettings at run time, and therefore if you want to change the value, then you must deploy a new version of the application.

However at runtime you have access to the the ServiceConfiguration.cscfg file and therefore can make on the fly modifications (as shown below)


This is one of those situations, that if you plan to run your application both in and out of the Fabric, then you should have a Configuration Manager of some sort to allow you to switch between the Azure ConfigurationSettings version and your normal appSettings version.

No comments: