0

I need some help with the Azure webjobs as even after reading many articles it is unclear how I can get a 'simple' Azure webjob up and running. I'm trying to achieve the following:

  1. The job should be run on a schedule (e.g. every 4 hours)
  2. The webjob should run without the use of queues (e.g. completely stand alone)
  3. The web application shouldn't have to be 'Always On'
  4. The webjob should be able run a long running task (e.g. 3 hours)
  5. If possible it should be possible run in the free tier

Below is a short code of example of what I'm experimenting with.

 static void Main(string[] args)
 {
      var host = new JobHost();
      host.Call(typeof(Program).GetMethod("RunTask"));
 }

 [NoAutomaticTrigger]
 public static void RunTask(TextWriter log)
 {
     log.WriteLine($"Executed: {DateTime.Now.ToLongTimeString()}");
 }

Does anybody have any experience with this?

Frank
  • 3,959
  • 4
  • 19
  • 24

1 Answers1

1

You can find your awnsers here: web-sites-create-web-jobs

1.The job should be run on a schedule (e.g. every 4 hours)

You can do this in the schedule, or you can use a CRON expression

2.The webjob should run without the use of queues (e.g. completely stand alone)

Depends on your definition of completely stand alone, a trigger is something from the outside that starts your job. Or you can use a CRON expression

3.The web application shouldn't have to be 'Always On'

When using a CRON expression, the job has to be Always On. When you trigger the job every 4 hours and it runs 3 hours, it seems your job is almost running all the time anyway

4.The webjob should be able run a long running task (e.g. 3 hours)

Use always on

5.If possible it should be possible run in the free tier

•Web apps in Free mode can time out after 20 minutes if there are no requests to the scm (deployment) site and the web app's portal is not open in Azure. Requests to the actual site will not reset this.

Peter
  • 27,590
  • 8
  • 64
  • 84