What is the difference between WebJob and Cloud Service? I'm trying to get an overview over the two and by definition they seem to be able to accomplish the same goal? Maybe Cloud Service has more features?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Cloud Services (Web/Worker Role) will give you a full virtual machine (VM). Since you wanted to compare WebJobs with Cloud Service, I am assuming you're interested in Worker Role. Typically you would want to use a Worker Role to process background tasks. You could do the same with WebJobs as well. From what I understand, here are some of the key differences:
- WebJobs are meant for one purpose only and that is processing jobs. You can do the same through Worker Role as well but since you're getting a full VM, you can do many more things with that (for example, hosting a node.js server).
- If your objective is to run scheduled jobs, WebJobs make it super easy for you. You essentially take a console application, deploy it as a WebJob and then do the scheduling of job through portal. With WorkerRole, it's not that straight forward. Essentially you would be responsible for scheduling of jobs which you could either do it through in-built .Net libraries (System.Timer etc.) or use 3rd party scheduling libraries like Quartz.net.
- If your application has dependency on some applications that you would need to install , you can't do through WebJobs. You could however install additional software in Worker Role through startup tasks.
- I guess in the end both of them are
PaaS
offering but I consider WebJobs as true PaaS offering as you just come with your task and the platform takes care of scheduling and executing that task.