Search code examples
c#.netazureazure-web-app-serviceazure-webjobs

Azure WebJob stuck in Initializing state


We have a WebJob in an App Service in a paid subscription. A few days ago the service went into Initializing state and we haven't been able to start it ever since.

These are the output logs: enter image description here

When we try to manually start it we get an error:

enter image description here

We have also restarted the app service to no avail. The last update on the environment was more than two weeks ago. I appreciate the website shut down on Sunday, however it is up and running now, therefore the WebJob should be able to start.

We wanted to check in Kudu, however Powershell always returns a print of the issued command? Is it because of lack of permissions? enter image description here


Solution

  • If your Webjob has failed to get initialized check the logs of your webjob by visiting The kudu console and the path below:-

    [xxxxxxxwebapwebjob.scm.azurewebsites.net/api/vfs/data/jobs/continuous/test/job_log.txt](https://xxxwebapwebjob.scm.azurewebsites.net/api/vfs/data/jobs/continuous/test/job_log.txt)
    

    enter image description here

    enter image description here

    You can directly check the Logs in the Logs section of Webjob:-

    enter image description here

    enter image description here

    Get-Service powershell command won't work in kudu to get your Webjob run status as Web app is a PAAS and we do not have access to underlying OS, You will have to invoke the Webjob rest API.

    And you can also call Get-Process command to check the running processes in Kudu:-

    enter image description here

    Also, If your Webjob failed to initialize,

    Check your Webjob source code and try to implement tracing in your code as mentioned in this SO answer by George Chen

    Also, Verify if all the settings and connection string in your Webjob code is set properly before webjob deployment.