I have an Azure website project I have been working on. This project required a scheduled task to run so I decided to give Azure WebJobs a try. Creation of the job and getting it to deploy was pretty straight forward. One of the things that is nice is for each instance your website uses the WebJob is duplicated. For some WebJobs this can be be a really nice feature.
The WebJob I am using does some data import and manipulation. Having multiple instances of this WebJob running is not what I wanted. After some searching I found that you can make your WebJob run on a single instance no matter how many instances your website is using.
To do this you will need to do the following.
- Add a “settings.job” file to the root of your WebJob project
- Modify the properties of the file and set the:
- Build Action = Content
- Copy to Output Directory = Copy always
- The contents of the “settings.job” file should contain the following json:
This should be all that is needed to get your WebJob running as a single instance when installed on many instances.