How to Run a Continuous WebJob as a Singleton

If your Azure Web Sites site is running on multiple instances and you create a new continuous WebJob, the WebJob will run on all instances by default. (Note that a triggered WebJob will run on just one instance selected at random.) You may want your continuous WebJob to run on only one instance. You can do so by creating a file called settings.job and adding the following to it:

{ "is_singleton": true } 

After you’ve added this line, save the settings.job file into the root folder for the continuous WebJob.

Alternatively, you can use the WebJobs API to do the same. There’s more information available on this at GitHub.

Comments (2)

  1. OzBobWa says:

    I feel as it is the only other setting in:…/JobSettingsKeys.cs


    deserves a mention,…/webjobs-graceful-shutdown

  2. Rohan Kulkarni says:

    I have deployed a Azure Web Job which listens to a Queue and then process the message received.

    When i run it locally, it runs perfectly well; but i deploy to Azure it exits with code -2146232576.

    [05/08/2015 13:28:42 > cb5dfe: SYS INFO] Run script 'CertsInvoicesJob.exe' with script host – 'WindowsScriptHost'

    [05/08/2015 13:28:42 > cb5dfe: SYS INFO] Status changed to Running

    [05/08/2015 13:28:43 > cb5dfe: SYS ERR ] Job failed due to exit code -2146232576

    [05/08/2015 13:28:43 > cb5dfe: SYS INFO] Process went down, waiting for 60 seconds

    [05/08/2015 13:28:43 > cb5dfe: SYS INFO] Status changed to PendingRestart

    When is the thing i am doing wrongly.

    What does this code mean.

    Please help!!!