Q:

Azure Webjob fails after 4 minutes

I have 3 webjobs. 2 run continuously for several months now without any problem.
The 3rd one I recently created and is a triggered webjob and listens to my storage queue.
This works fine, except after 4 minutes the webjob crashes and the status is set to 'Failed'.
Looking at the error log I see this:
was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.

But the whole idea is that the webjob will do its task when something is put on the queue, in the meantime, the webjob can go IDLE that is no problem.
It seems I'm missing the big picture. I did start the webjob in the portal. Was that wrong? Should I keep it on 'Ready'?
What is the correct workflow to create a webjob that listens to the queue, sleeps when it has nothing to do and wakes up again when something is put on the queue?

A:

First answering the questions:

I deployed it as a Triggered WebJob
I am using the WebJob SDK
I'm not familiar with Azure function
I enabled Always On

Now the solution. Yesterday evening I added WEBJOBS_IDLE_TIMEOUT to the Application settings in the Azure Portal and set its value to 3600, which should mean 1 hour.
I also added this setting to my <appSettings> in app.config and just noticed my WebJob is still running (over 11 hours now). I just put something on the queue and it is nicely processed.
I'm not sure why it is now working but I'm glad it does ;)

