Is it possible to edit web.config file of my cloud app deployed on Windows Azure without redeploying my app ?
Scenario is like–>
- Cloud app is deployed on Azure with 3 instances.
- web.config has some static text in appsetting which is displyed on the Home Page(for example – © 2009 My site. All rights reserved)
- Now I wish to change that static text mentioned in Web.Config from 2009 to 2010.
- Now I wish to edit Web.Config without redeploying my site.
- I do not wish to –> deploy my app on stagging with updated Web.Config and then swap it with production.
Is there any trick to update the files from package deployed at runtime ?
According Maxim in the comments below this answer is now out of date.
You can programmatically modify the web.config settings of a web role in the OnStart event using the Microsoft.Web.Administration.ServerManager library.
*** leaving the original answer as it was correct at the time and as, I have not used Azure since answering this question, and I am not 100% sure of the valid answer.
In a word no.
You must use the service configuration file for such settings.
To decide on whether to place keys in the service configuration settings versus web configuration settings.
You could ask yourself the following questions:
Does this setting change with every deployment? If so then the web configuration settings is the correct place for this information.
Will this setting change after deployment? If so then the service configuration settings is the correct place for this information.
The Web.config file is part of the deployment package and so is read-only when deployed to Azure, in order to update the settings you will need to redeploy.
Whereas the service configuration file is uploaded with, but not packaged with, the deployment package, and therefore you can upload or edit the file without redeploying your service.