Stop an Azure Web Job using WEBJOBS_STOPPED and WEBJOBS_DISABLE_SCHEDULE configuration settings

We had one triggered web job running every 5 minutes that would pull the data from SQL On Prem DB and create lead records in CRM.

During testing we wanted to stop the running web job.

To do go to Application Settings for the App Service. Add WEBJOB_STOPPED and WEBJOBS_DISABLE_SCHEDULE setting with value 1.


We’d see our web job stop running.



Another option is to kill the process itself

Open à

https://[appname].scm.azurewebsites.net/ProcessExplorer


Get all the details here


https://github.com/projectkudu/kudu/wiki/WebJobs

Hope it helps..


Update Schedule of existing Azure WebJobs (triggered)

Suppose we have following WebJob deployed in Azure of type Triggered.

And now we want to update its schedule.

To do so,

Open the App Service Editor

Update the CRON expression in settings.job (in case of scheduled web job), if the file is not there we can create and add it.

This makes the Webjob to run every 1 minute.

Back in our Webjob we can see the schedule updated.

Inside the logs à

More details –

https://github.com/projectkudu/kudu/wiki/WebJobs#scheduling-a-triggered-webjob

Hope it helps..

.

Using log4net with Azure WebJobs

To get started, let us create a C# Console Application and add the NuGet Package for log4net.

Update the App.Config with log4net configuration.

The most important part here is value of file.

The D:\Home\LogFiles is the path where our WebJob can write to.

https://docs.microsoft.com/en-us/azure/app-service/web-sites-enable-diagnostic-log#download

Inside our program.cs initialize the log4net.


Publish the WebJob to Azure.

Open the Kudo, we can see the Folder created

And our log file

Get all the details here

https://blogs.msdn.microsoft.com/benjaminperkins/2017/09/27/how-to-configure-log4net-on-azure-app-service/

Hope it helps..