简体   繁体   中英

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.

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 (eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM