Dave New
Dave New

Reputation: 40092

Migrating to Azure Web Role - porting the web.config file

I am migrating an existing Web Application to a Web Role. Does this mean that the web.config will be ignored?

I have connection strings, provider details, and tons of other config items in the web.config. Do I have to attempt to port all of this to the Azure ServiceConfiguration.Production.cscfg file?

In development, the Compute Emulator will not be used (since it takes so long), so we will still need the web.config files.

Upvotes: 1

Views: 238

Answers (1)

Simon Opelt
Simon Opelt

Reputation: 6211

It depends on your use-case. The cscfg allows you to reconfigure your WebRoles once deployed without creating a new package and redeploying/upgrading/staging+swapping. I especially think of scenarios where continuous integration is used and release procedures are no longer trivial.

If this scenario is not relevant you could just stick with the web.config and build and deploy new packages on configuration changes.

You could also selectively move items you assume that will regularly change in order to benefit from the configurability without having the effort of migrating everything.

I have used wrapper classes which abstract the configuration mechanisms (web.config app settings keys vs cscfg configurationsettings) in order to be able to use the different configuration mechanisms (e.g. check cscfg and fall back to web.config or the other way round or something along that lines).

Update: If you are using a "recent" azure SDK (1.7+) here is CloudConfigurationManager which might do most of the work for you.

Upvotes: 1

Related Questions