I have a .Net console app that I have recently deployed to Azure as as a WebJob. Though it successfully deployed when it runs it exists straight away with the following error: - Job failed due to exit code -2146232576
And the WebJob status is set to ‘Pending Restart;.
It turns out that I was targeting the .Net 4.7.2 framework, and Azure only supported 4.7 of the framework. After downgrading my console app to 4.7 it ran OK as a WebJob.
Checking which framework is supported
Login to Azure and go to the App Service the WebJob is running under. Go to the Application Settings, and the first option has a select list of which .Net frameworks versions are supported. At the time of writing I had the options of 3.5 or 4.7.
Downgrading you console app
Downgrading is straight forward: - Change the target framework via the project properties - Update packages.config so all the .Net reference are changed from 4.7.2 to 4.7