What does "Pending Restart" mean? I have stopped and restarted my WebJob numerous times and that doesn't seem to fix it. Does it mean I have to restart my website? What caused my job to get in this state in the first place? Is there any way I can prevent this from happening in the future?
WebJobs is a feature of Azure App Service that enables you to run a program or script in the same instance as a web app, API app, or mobile app. There is no additional cost to use WebJobs. You can use the Azure WebJobs SDK with WebJobs to simplify many programming tasks.
You can use the WebJobs feature of App Service to run a script or code in the context of an App Service web app. The WebJobs SDK is a framework designed for WebJobs that simplifies the code you write to respond to events in Azure services.
Deploy to Azure App ServiceIn Solution Explorer, right-click the project and select Publish. In the Publish dialog box, select Azure for Target, and then select Next. Select Azure WebJobs for Specific target, and then select Next. Above App Service instances select the plus (+) button to Create a new Azure WebJob.
# # This is a WebJob that restarts the current app service. # # Prerequisites: # # 1. The system assigned managed identity (MSI) must be enabled. # To enable: Azure Portal → this App Service → Identity → Status → On. # # 2. The MSI must be authorized to restart this app service.
Stopped - The WebJob was stopped (usually from the Azure portal) and is currently not running and will not be running until it is started again, best way to see this is as disabled. Also, take a look at the webjob log, it should hold cue to what's been happening.
Also, take a look at the webjob log, it should hold cue to what's been happening. if the JOB is set to run continuously, once the process exits (say you are polling an queue and it's empty) the job shuts down and status changes to "pending restart". Azure Scheduler will typically restart the process in 60 seconds.
To stop or restart a continuous WebJob, right-click the WebJob in the list and select Stop or Start. In the Azure portal, search for and select App Services. Select your web app, API app, or mobile app from the list.
Usually, it means that the job fails to start (an exception?). Look in the jobs dashboard for logs.
Also, make sure that if the job is continuous, you actually have an infinite loop that keeps the process alive.
To add to Victor's answer, the continuous WebJob states are:
Also, take a look at the webjob log, it should hold cue to what's been happening.
if the JOB is set to run continuously, once the process exits (say you are polling a queue and it's empty) the job shuts down and status changes to "pending restart". Azure Scheduler will typically restart the process in 60 seconds.
Try changing the target framework to .NET 4.5. This same issue was fixed for me when I changed the target framework from 4.6.1 to 4.5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With