5

Some time ago, I used Visual Studio (2015) to create a WebApp, a console app and link that console app as OnDemand WebJob to the WebApp. I published the whole to Azure and the website, the WebJob and the Scheduler Job worked perfectly.

Last week, I noticed that the WebJob no longer runs. The website is under constant development, so I am not sure whether this is due to a change in code we applied or due to something in Azure.

Whatever I try (including completely removing the job, the schedule and the folders in App_Data on the webapp), when I publish the WebApp from VS, the webjob is recreated, but the scheduler fails with the error below.

Http Action - Response from host 'mysite.scm.azurewebsites.net': 'Unauthorized' Response Headers: Date: Fri, 29 Jan 2016 07:02:01 GMT
Server: Microsoft-IIS/8.0
WWW-Authenticate: Basic realm="site"

Body: 401 - Unauthorized: Access is denied due to invalid credentials. Server Error

Any clue what might cause this problem or which additional info I can collect to trace down the actual problem?

Thanks, Erik

Erik123
  • 201
  • 1
  • 2
  • 8

2 Answers2

3

We made a tweak to the WebJobs publishing NuGet and released an update to it. This update resolves the scheduler auth header issue. Once you update the publishing NuGet to be the 1.0.11 version this issue will be resolved.

https://www.nuget.org/packages/Microsoft.Web.WebJobs.Publish/1.0.11

brady gaster
  • 1,506
  • 1
  • 10
  • 15
  • Have an upvote. Well done, you broke something, pissed me off and still manage to get stackoverflow karma... – Skarsnik Mar 30 '16 at 05:44
  • and then we fixed it. WE meaning like, three teams. no one person can fix - or break - something this massive. – brady gaster Mar 31 '16 at 06:04
  • Also fyi - we've got some huge improvements coming to this entire experience. Apologies again, and hope the update fixes you. If not reach out directly and we'll try to work through it. – brady gaster Mar 31 '16 at 06:07
  • All good, my comment was tongue in cheek. Your solution did indeed fix the problem for me. Cheers – Skarsnik Mar 31 '16 at 07:02
2

This means that your http request to mysite.scm.azurewebsites.net (where your webjob is waiting) doesn't have the right creds on the request.

Go to your portal.azure.com and then open your scheduled web job within the scheduler collection. In the action tile, do you see if it's using any authentication? If it isn't select Basic authentication. Here you'll need to put in the user name and pw of your web app. You can get both of these values from the publish profile of the web app. Refer to this post if you don't know where it is.

Community
  • 1
  • 1
Haymaker87
  • 519
  • 7
  • 18
  • 1
    Thanks for the hint in the right direction. I tried adding the authentication credentials in the Azure portal and got an error that a free task collection cannot contain tasks with authentication. In the end I decided to create a simple batch job that triggers the webjob with a http-post until I have the budget available to upgrade the scheduler task collection to Standard or Premium. – Erik123 Feb 02 '16 at 12:42
  • Yeah, I had the same issue where I was using a free job collection. Once you upgrade it, it should work. – Haymaker87 Feb 02 '16 at 15:25
  • I'm running into the same problem, but I don't want to upgrade to paid webjobs! Is there any other way to solve this problem? – Farlop Feb 21 '16 at 22:40