Is it possible to edit web.config file of my cloud app deployed on Windows Azure without redeploying my app ?
Scenario is like-->
Is there any trick to update the files from package deployed at runtime ?
If you want to change web. config files you can use the Azure portal, there is a tool called "App Service Editor" in preview or Kudu that lets you edit any of the files you've deployed.
Deploying Windows to Azure cloud. In order to deploy a Windows application to Azure, you should have an application entity created in Spinnaker. A firewall and a load balancer should be set up prior to configuring a deployment pipeline.
You can deploy your WAR, JAR, or EAR package to App Service to run your Java web app using the Azure CLI, PowerShell, or the Kudu publish API.
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.
It is possible and if you do changes to web.config, the ASP.NET app will restart with the new settings, just like you would expect on "normal ASP.NET". You just need to be certain you are making the right updates to web.config or your instance is probably impossible to repair once ASP.NET is gone with a web.config error.
If you have web.config as part of your deployment package you need to change the file permissions on it, which you can do from RoleEntryPoint.OnStart().
Another way would be to have your ASP.NET app write the initial web.config itself via some init web handler.
By default the ASP.NET app will not have update or delete permissions to files from the deployment package or files written by your RoleEntryPoint code, while it has full access to files it itself create. This behavior is only experienced on "real Azure" while things behave otherwise when running locally with the SDK.
Check this for info about writing files and setting permissions on files from RoleEntryPoint.OnStart(): How can I get the WebRole site root path from RoleEntryPoint.OnStart()?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With