An error occurred while creating the WebJob schedu

2019-01-22 17:31发布

问题:

I an trying to publish my website along with few WebJobs but after the website and the jobs are created on the Azure Website, I see an error on the VS.NET 2013 that says:

Error   948 An error occurred while creating the WebJob schedule: No website could be found which matches the WebSiteName [mysitename] and WebSiteUrl [http://mysitename.azurewebsites.net] supplied

my website has 2 WebJobs, 1 that runs continuously and it's created and running, but the one that needs to be triggered on a schedule is having this problem.

Any ideas as to what may be wrong here?

Edit 1

Just wanted to add that the Scheduled Job is getting created as "On Demand"

here is the settings for publishing I am using :

{
  "$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
  "webJobName": "ArchiveShipments",
  "startTime": "2015-01-11T00:00:00+05:30",
  "endTime": null,
  "jobRecurrenceFrequency": "Day",
  "interval": 1,
  "runMode": "Scheduled"
}

BTW after i applied AzureSDK. 2.5 I don't see any error on publishing, but the scheduled WebJob is not getting created.

回答1:

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.



回答2:

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.



回答3:

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.



回答4:

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.



回答5:

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.



回答6:

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.



回答7:

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).



回答8:

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



回答9:

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!