0
votes

What If I just want to modify the web.config of web role . I don't want to change the rest of web role. It seems every time I publish the web role .VS2010 will upload all the files in web role to azure . Can I just upload a specified file of web role to cloud services? thanks

2

2 Answers

3
votes

Nope. This is not possible with Cloud Services. Meaning that if you change the web.config, you have to redeploy the whole role.

That's why it may be appropriate to take a look at the .cscfg file - the cloud service configuration file. As anything there can be changed on the fly (while your role is running). This, of course will add some initial overhead, as you will have to change (if used anywhere) all references to connection string that of the kind <%$ ConnectionStrings:MyNorthwind%>. But once you change all configuration related settings to read from platform agnostic source (be it web.config or cloud service config, or even an Azure Table storage) you will have very flexible application deployment options. The only thing that cannot be changed via service configuration yet is the system.serviceModel section of the web.config. As the WCF auto-wiring relies heavily on it. This is only if you are using WCF services. But, even the WCF services can be dynamically configured.

UPDATE (after the comment)

You have to redeploy, because this is public cloud offering Platform-As-A-Service. Which includes automatic "healing" of hardware failures, OS patches/updates, runtime (.net) updates, unlimited scalability. The PaaS stuff is stateless. Stateless means that no state is preserved across system healings/restarts/failures/scale-out/scale-in processes. What you prepare for the system (the .cspkg and .cscfg) are used as a "base image" to shape a Cloud Service when something happens (initial deployment, healing deployment, etc).

I personally don't see redeployment so time-consuming. Maybe I haven't faced large enough deployment. But, as a best practice I upload my CSPKG/CSCFG in a blob storage container, then I deploy/upgrade from there. If I have to "re-deploy" I just do perform an "Automatic Upgrade" and the Azure platform Fabric (this is that intelligent thingy that makes sure my service is live and running) takes care of the rest. The rest is taking instances out of load balancer, updates my package, moving instances back to the load balancer rotation and so on for each upgrade domain.

0
votes

Unfortunately azure does not allow for a package to be updated file by file. A whole package has to be redeployed. This is a real pain when having packages which are large in size. A solution of mine usually takes around 45 minutes to upload.

My suggestion is to create a virtual machine on azure and host your website there. Remember to open the http port 80 as an endpoint and if you are planning to have load balanced machines, the files must be replicated on all servers. Virtual machines are stateful rather than stateless (web role vms) therefore your settings and data will be persisted.