0

I everyone, I have created a azure web job that should run daily every 5 minutes between 06.00am and 10pm.

This is the CRON expression I have used 0 0/5 6-10 * * *.

But for some reason the job run continuously, in the night too. The app service under the web job runs has the Always on set on On.

Here the code of my job:

static void Main(string[] args)
{
    MyEngine myEngine = new MyEngine();
    myEngine.Run();
}

myEngine.Run() run the following code:

Threading.Task.Run(() =>
{
    this.processTaskActivities();
}, this.cancellationTokenSource.Token);

I do not think this is the correct approach to run a web job, but I cannot change it...

Why my webjob run alway?

Thank you

EDIT I let you see how the job is configured:

enter image description here

PS.: The CRON expression is just to text according the time. To understand if it stops and if it runs when necessary

Simone
  • 2,304
  • 6
  • 30
  • 79

1 Answers1

0

You can create a file called settings.job along with your project and while deploying it will automatically detect the cron expression

settings.job

{"schedule": "0 0/5 6-10 * * *"}

Follow this Article

Jayendran
  • 9,638
  • 8
  • 60
  • 103
  • I already had that file and I was already modifying it. But no success – Simone Oct 11 '18 at 16:50
  • Are you sure your WebJob is deployed as a Triggered WebJob and not Continuous? – David Ebbo Oct 11 '18 at 17:26
  • @DavidEbbo Yes... I have checked.. it is triggered and near I can see the CRON expression – Simone Oct 11 '18 at 18:47
  • @Ciccio please see [here](https://social.msdn.microsoft.com/Forums/en-US/764c7776-ca87-4246-a1ea-f6253efd498b/cronscheduled-webjob-not-working?forum=windowsazurewebsitespreview#73262188-d93b-4d33-b780-ae2ea5eb4e2c) for the solution. I think you may miss one of these solutions. – Jayendran Oct 12 '18 at 02:38
  • I checked... I deployed again but now never run... I upload a hpto to ley you see the configuration – Simone Oct 12 '18 at 07:30
  • @Ciccio The image tells that job is deployed successfully. It will run. If you have any issues within your job. Then you have to see the webjobs logs – Jayendran Oct 12 '18 at 08:04
  • @Jayendran i do not have any issue. Logs do not show any error. The problem is the job runs continously even when should stop according to the CRON expression – Simone Oct 12 '18 at 09:28
  • @Ciccio From your updated image it is showing as `Ready` and type is `triggered`. How you are telling that it is running continuously? – Jayendran Oct 12 '18 at 09:35
  • @Jayendran I wrote it... "I deployed again but now never run... I upload a photo to ley you see the configuration"... It seems azure is ignoring my CRON expression... like it does what it wants... I do not understand why.. what's wrong – Simone Oct 12 '18 at 10:15