WebJob And Its Types In Azure

In this article, you will learn about webjob and its types in Azure.

Introduction

 
In this article, I will discuss web jobs and its types in Azure.
 
Azure web job is like a service that can run a task in the background. It doesn’t contain any user interface and it is the same as our Windows service.
 
The scenarios where we use Azure web jobs are,
  • Image processing or other cpu-intensive background work.
  • Queue processing.
  • File maintenance, such as aggregating or clean up log files.
  • Long-running tasks such as sending emails.
There are 3 types of web job such as,
  • Continuous web job
  • Manual triggered web job
  • Scheduled triggered web job

Continuous Web Job

 
In a continuous web job, once the web job created it keeps on running all the time.
 
Below, I will explain how to create a continuous web job.
  • Login into your Azure account with proper credentials.
  • Go to app services and click on particular app service which you want to select.
  • Go to web jobs.
  • Click on add and a new popup will come from the right-hand side.
  • In the popup, add a name, upload zip file (zip file of our console application), select type as continuous and select scale as multi-instance/ single instance and click on ok which is shown in the below figure,
WebJob And It's Types In Azure
 
It will take some time to create the web job and after that, the web job will show under web jobs section.
 

Manually-Triggered Web Job

 
In manually-triggered web jobs, once the web job is created we need to manually trigger the job in the portal.
 
Below I will explain how to create a manually-triggered web job.
  • Login into your Azure account with proper credentials.
  • Go to app services and click on particular app service which you want to select.
  • Go to web jobs.
  • Click on add and a new popup will come from the right-hand side.
  • In the popup, add a name, upload zip file (zip file of our console application), select type as triggered and select triggers as manual and click on ok which is shown in below figure,
WebJob And It's Types In Azure
 
It will take some time to create the web job and after that, the web job will show under web jobs section. 
 

Scheduled Triggered Web Job

 
In scheduled triggered web job, once the web job is created it will trigger automatically.
 
Below I will explain how to create a scheduled triggered web job.
  • Login into your Azure account with proper credentials.
  • Go to app services and click on a particular app service which you want to select.
  • Go to web jobs.
  • Click on add and a new popup will come from the right-hand side.
  • In the popup, add a name, upload zip file (zip file of our console application), select type as triggered, select triggers as scheduled, select cron expression as “00****”(which means we set the web job for 1 hour) and click on ok which is shown in the below figure,
WebJob And It's Types In Azure
 
It will take some time to create the web job and after that, the web job will show under the web jobs section.
 
After every 1 hour (or whatever the time set in the cron expression), the web job will run automatically.