What are Microsoft Azure Web Jobs
An Azure Web Job is a background process that runs on the same virtual machine instance as the website, for which the Web Job is ‘working’. It is kind of a lightweight Worker Role associated with the website. Process life cycle is strictly connected with websites, so restarting a website will cause a Web Job restart. They will also scale together with the owner website. That clearly implicates that not every kind of job is a good candidate to become a Web Job.
Tasks that have been identified as good Azure Web Jobs are:
- Image processing ( CPU-intensive work)
- Queue/blobs/notification processing – this seems to be especially useful when we want some lightweight processing of Azure blob storage (simple implementation later in this post)
- Retention mechanisms – for example for old log files
- Long running processes
As Web Job we can run applications or script written in many popular languages/technologies.cmd, .bat, .exe to name a few. Azure stores each Web Job in separate folder under path matching a pattern: \wwwroot\App_Data\\. When Azure is asked to run a Web Job it first looks for a file with name matching ‘run.’, if file is not found it looks for the first file with one of the supported extensions. If the second lookup fails, Azure reports error that it was not a valid Web Job.