I deployed a WebJob the suggested way using Visual Studio, right-click onto the console project, selecting "Publish as Azure Webjob" and going through the settings.
I selected a scheduled plan what caused the file "webjob-publish-settings.json
" to be created in the Properties-Folder with the following content:
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "TestCredentials2",
"startTime": "2016-04-05T01:00:00+01:00",
"endTime": "2016-04-12T00:00:00+01:00",
"jobRecurrenceFrequency": "Minute",
"interval": 3,
"runMode": "Scheduled"
}
While the deployment worked, the webjob is in the state "On Demand". The Webjob is run once when I start it manually from within the Azure Portal but does not restart ever automatically.
I also tried to add a "settings.job
" to the root of my project (with the setting "Copy if newer"):
{ "schedule": "0 /5 * * * *"
}
Still no difference in the behaviour, but also no error message.
To change the schedule, or to Modify the CRON value just use the App Service Editor to modify the WWWROOT/App_Data/jobs/triggered/YOUR_WEBJOB_NAME/settings. job file; By the time of writing, App Service Editor is still in preview but it will work.
Go to the Azure portal, select your WebSite, then go to WebJobs and select ADD a job. Enter a Job name, select the . zip file, select when the job shall run and click ok.
Go to app services and click on a particular app service that you want to select. Go to web jobs. Select a web job and click on the delete button.
It did work using the settings.job
approach. The following things had to be done:
1. Create a settings.job with the content in the question
2. select Build Action "Content" for that file
3. Select "Copy if newer"
4. Delete the generated "Properties/webjob-publish-actions.json"
5. Re-Publish the Project, chose "On Demand" instead of a schedule plan
this creates a new webjob-publish-actions.json:
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "MyTimer",
"startTime": null,
"endTime": null,
"jobRecurrenceFrequency": null,
"interval": null,
"runMode": "OnDemand"
}
Done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With