An error occurred while creating the WebJob schedule

拥有回忆 提交于 2019-11-28 21:06:59

For me this happened when I switched from deploying to one Azure account to another account. In Visual Studio, open/expand the Server Explorer side-window, right click on Azure, select "Connect to Microsoft Azure Subscription...". You'll be asked to logout and login with new credentials.

If you get this error when publishing from PowerShell, it probably means you are not logged into to your azure subscription or logged into the wrong subscription. If the browser is not prompting for your credentials, it's probably using the wrong subscription. If does not ask for login, clear the cookies and try again.

I had this problem when trying to publish my webjob to a deployment slot.

The webjob got published, but the website was not found when trying to hook up the schedule.

I was able to go around this by doing 1 manual publish through the portal, and setting the schedule there. After that i could just publish from VS, and the schedule would remain untouched.

I have spent all day on this. The solution for me was to do a manual deployment of the web job via uploading a ZIP and scheduling it as desired. Then, in VS, I did Add Existing Project as Web Job and publishing the Web Site updates the scheduled Web Job as expected.

After recent updates, something changed. I was unable to publish to any of my subscriptions where I had a scheduled job. After much digging around, the solution is as follows: - Right click solution and Manage NuGet Packages for Solution - Change all Web Publish modules down to version 1.0.3

Publish. Problem solved.

Tried everything here and still had the same issue but I managed to resolve by doing the following:

I have a package called Microsoft.Web.WebJobs.Publish installed which was running an old version (1.0.3). I updated to the latest, currently 1.10.12, and then the app and webjob/schedule published first time.

I ran into this again in VS2017, and the root cause was the deprecation of the VS Azure Scheduler integration feature. Per David Ebbo's recommendation in the linked thread, I converted my webjobs to use the CRON scheduling feature and publish now works as expected. Note that the Always On setting must be enabled on the app.

Some more debugging options if you're encountering this:

  • Make sure the correct publish profile (pubxml) file is being used. I had several publish profiles files for the same webjob and tried publishing with the wrong one by mistake.

  • I suggest trying first to publish the webjobs separately, one by one (rather than publish them all alongside the website).

  • If you can't get a webjob to publish, delete its Properties\PublishProfiles folder and try to publish again - you'll be greeted with a VS wizard that should get you sorted (it will recreate the pubxml files correctly).

Try updating to Version 2.9 of the Azure SDK, which fixes a related issue:

Repaired issue related to Scheduled WebJobs in which the authentication information was failing to be passed to the Scheduler provisioning process

(https://www.visualstudio.com/en-us/news/vs2015-update2-vs.aspx)

EDIT:

I ultimately gave up using this scheduler, and switched to the Kudu Scheduler (Internal WebJob Scheduler). See: https://github.com/projectkudu/kudu/wiki/Web-jobs#scheduling-a-triggered-webjob

It is actually easier to set up. All you need to do is add a settings.json file to the webjob with the following contents: {"schedule": "the schedule as a cron expression"}

The pros and cons of using the using the Azure Scheduler vs the Kudu Scheduler are discussed here: http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/#.Vz4sk5ErJaQ

An important limitation not mentioned in that blog post is that creating a schedule more frequent than hourly is not supported on the free tier of the scheduler (which you are probably using if you haven't intentionally changed it, as it is separate from the app service tier). This is what finally drove me to the Kudu scheduler, as I needed to schedule my job to run every 15 minutes

Updating the nuget package to the latest update, in my case 1.10.12, did the trick.

HOWEVER visual studio did not manage to remove the previous package. To do this I had to restart windows, and then before opening up visual studio, deleting the folder containing the old version of webjobs.publish.

This did the trick for me!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!