5

I'm not being able to publish a scheduled WebJob to Azure App Service. I'm using Visual Studio 2017.

With this settings all works fine:

{ "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json", "webJobName": "WebJobName", "runMode": "OnDemand" }

But when I set this settings:

{ "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json", "webJobName": "WebJobName", "startTime": "2017-03-17T07:00:00+00:00", "endTime": "2027-03-17T07:00:00+00:00", "jobRecurrenceFrequency": "Day", "interval": 1, "runMode": "Scheduled" }

Visual Studio 2017 crashes at the "Creating the scheduler job" step.

I can't find how to schedule this job, I'm using the package Microsoft.Web.WebJobs.Publish 1.0.13

Can anyone help me?

Thanks

Asier Peña
  • 378
  • 3
  • 12

1 Answers1

4

The feature where VS configures the Azure Scheduler has many issues, and is on the way to deprecation. Instead, the suggested approach is to rely on the CRON feature described here.

As an aside, if you want to get the scheduler working and not move to CRON, one thing you should do is upgrade to the latest version on the WebJobs NuGet package, which should solve this particular issue.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117
  • Hello, thanks for the workaround, I've considered it before, but It was not clear to me how to upload the exe with all dlls and resources of the webjob (console application in my case), I understand that I should zip all with the settings.job file. The more strange is that the scheduled has worked!! This morning I've seen that the job has executed at the scheduled time!! Visual Studio 2017 crashes, the Azure webjobs page doesn't show the schedule, but it works!! – Asier Peña Mar 17 '17 at 12:41
  • Thank you David. The CRON approach is cool, but it has one major drawback - ***Always On*** must be enabled... – Ohad Schneider Jul 04 '17 at 08:25
  • Indeed. Note that it's still possible to user the Azure scheduler if you want to. Also, you can look at Azure Functions in consumption mode which sorry cron without Always On. – David Ebbo Jul 04 '17 at 09:19
  • It is in fact deprecated on VS2017. WebJobs with a schedule (`"runMode": "Scheduled"` in `webjob-publish-settings.json`) will cause the crash. Can somebody point to a definitive post by Microsoft? Also, I'm using `Microsoft.Azure.WebJovs` package v2.0.0 and it doesn't seem to fix this. – Doc Sep 11 '17 at 13:18
  • 2
    Not sure why it crashes VS. Just don't try to use `"runMode": "Scheduled"` in 2017. – David Ebbo Sep 11 '17 at 16:35