0

I have an Azure webjob that was created as a console application and published to azure via Visual studio.

When I login to the portal, I can see the web-job is running, but I want it to run every 1 hour.

How can I do this? Schedule seems to say n/a

Ayo Adesina
  • 2,231
  • 3
  • 37
  • 71

2 Answers2

0

Two options:

use Hangfire and schedule to run every one hour:

RecurringJob.AddOrUpdate(() => Console.WriteLine("This job will execute once in every minute"), Cron.Hourly);

Change the Web Job to Azure Functions and use the time trigger:

 public static void Run([TimerTrigger("* 0 */1 * * *", RunOnStartup=true)]TimerInfo myTimer, TraceWriter log)
{
//code
}

more info:

https://github.com/HangfireIO/Hangfire

https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-scheduled-function

Thiago Custodio
  • 17,332
  • 6
  • 45
  • 90
0

Use a "triggered/scheduled" WebJob instead of a continuous one.

https://learn.microsoft.com/en-us/azure/app-service/webjobs-create#CreateScheduledCRON

enter image description here

Alex AIT
  • 17,361
  • 3
  • 36
  • 73