How to deploy only worker/web role in Azure

本秂侑毒 提交于 2019-12-04 21:01:40

问题


If you have a web AND a worker role in an Azure solution, all the waiting for the publishing an update package, uploading to the cloud storage, waiting for the package to be deployed could be exhausting, an waste a lot of time. How to upload/deploy only the worker or web role of an Microsoft Azure Solution, that contains both roles, and save both internet traffic and time?


回答1:


There is no option to build a package for only one of the both roles, but if you have limited bandwidth or traffic, and want to save from the upload time (which can be quite a big portion if you have a lot of static content: Look here for an example), there is one option.

As maybe you know, the package generated from Visual Studio for deployment (the 'cspkg' file) is nothing more, than an archive file. Suppose, you want to update the WORKER role only. The steps are:

  1. Create the update package as normal
  2. Open it with the best archive manager (7zfm)
  3. Inside, besides the other files are 2 'cssx' files - one for each role. Delete the unnecessary cssx file.
  4. Upload to Azure Blob Storage (optional)
  5. Update the instances from the Azure Management Portal using the 'local' or 'storage' source as normal
  6. On the Role dropdown, select only the role you want to update
  7. Press OK :)

Hope this helps.




回答2:


It is a lot easier to just add two additional cloud projects to your solution. In one project, have it reference only your web role. In the other project, have it reference only your worker role.

You can keep the cloud project that references both roles and use that for local debugging but when it is time to deploy, right click the cloud project that references only role you wish to deploy and click "Publish"

You will end up maintaining configuration files for each cloud project but that sounds a lot easier than manually messing around with editing the package file each time.



来源:https://stackoverflow.com/questions/15866633/how-to-deploy-only-worker-web-role-in-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!