0

I am having a continuous Webjob which works fine for a couple of hours and then does not work until I restart. It seems to me azure takes it to idle mode but it shows me it's running but doesn't actually run. I have set the Always on option ON. I am having a paid plan with Azure. Do I need to use a timer or thread delay or some doughy code to keep it alive in my code? If that's the case whats the purpose of continuous option in webjob.

maxspan
  • 13,326
  • 15
  • 75
  • 104
  • Is this happening multiple times, or just one time? – Joy Wang Jul 02 '18 at 06:33
  • Someone use the Azure SDK in application which is not supported in the WebApp environment cause this problem, you could refer to [it](https://stackoverflow.com/questions/32844626/continuous-web-job-stops-even-if-always-on-is-enabled?rq=1). – Joey Cai Jul 02 '18 at 06:39
  • I am not using azure ask. And it happens Daily. – maxspan Jul 02 '18 at 10:36
  • Any chance that your continuous job executable is terminating on its own? Continuous WebJobs need to have forever loops. – David Ebbo Jul 02 '18 at 19:29
  • Thank you David. That means I need to add a Thread or timer to keep it awake. – maxspan Jul 02 '18 at 22:11
  • I think David refers to that your code needs to have a forever loop e.g https://imagebin.ca/v/47Nlx1aNEgcn – Jarnstrom Jul 03 '18 at 06:41
  • Does the webjob logs say anything on why it terminates? Here is a goog blog about the logging options - https://blog.kloud.com.au/2016/03/14/azure-webjob-logs-demystified/ – Jarnstrom Jul 03 '18 at 06:43
  • No it doesnot say anything. – maxspan Jul 03 '18 at 22:07
  • I had this issue, it was an error I was eating in a try catch - I also found loop/forever webjobs tend to fail over time (hang), so moved to a cron trigger which executes once per trigger. Good luck with the webjob dark arts... – Tony Trembath-Drake Aug 04 '18 at 12:20

1 Answers1

0

Just to provide some documentation to back up the below comments you can have a look of the article here: https://learn.microsoft.com/en-us/azure/app-service/web-sites-create-web-jobs#webjob-types

It provides the following information in regards to Continuous WebJobs:
Starts immediately when the WebJob is created. To keep the job from ending, the program or script typically does its work inside an endless loop. If the job does end, you can restart it.

I have outlined the part relevant to your question

Hope this helps provide some clarity

Cheers, Lachie

Lachie White
  • 1,246
  • 2
  • 14
  • 21