Reputation: 1998
I deployed a continuous WebJobs to my existing Azure WebApp using DevOps. It is up and running.
When I tried to stop the webJob in the Azure web frontend it did not work. So I used the stop Command of the Azure WebApp API.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop?api-version=2016-08-01
Surprisingly this call returned a 404 error.
However, when I executed the Get Continuous WebJob Command it returns all infos about the webJob, which means that it could be found.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}?api-version=2016-08-01
I also tried using the Kudu API.
POST /api/continuouswebjobs/{job name}/stop
However, the stop command resulted in the same 404 response message whereas the get command resulted in a positive result that the WebJob is in State "Running".
GET /api/continuouswebjobs/{job name}
Is there any reason for this behavior? How is it possible to start/ stop the webJob using the above mentioned post requests.
Upvotes: 4
Views: 1929
Reputation: 1661
According to what I read here, the accepted answer's linked subject (worth reading!), and my own configuration problem that concerned only one project of our projects, I noticed that in our case, the webjob that causes the 404 error was not published with the same output directory, it was published with $(Build.ArtifactStagingDirectory)/My.Api/app_data/jobs/Continuous/MyWebjob
instead of $(Build.ArtifactStagingDirectory)/My.Api/app_data/jobs/Continuous/
So in our case we don't use virtual applications.
Upvotes: 0
Reputation: 1998
As it turned out the way I was deploying was the root of the problem.
Daniels answer to this question helped me a lot.
Basically you need to create a Virtual Application within your WebApp and then deploy your WebJob to this application from within Azure Devops.
When done this way you are in a position to successfully start/ stop the continuous webjob with all of the above mentioned APIs.
Upvotes: 4
Reputation: 14324
What's your way to stop webjob in the front end?
And the API to stop a continuous webjob, you could try with this
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/continuouswebjobs/{webJobName}/stop?api-version=2016-08-01
Further more information, you could refer to this doc:Stop Continuous Web Job
Upvotes: -1