Sometimes we need to develop console application in .net and need to schedule it in Azure portal. In my example I am going to develop a simple Hellow World console app.

Open the Microsoft Visual Studio and create a new project of type “Console App (.NET Framework).”

Microsoft Dynamcis NAV

Develop your hellow world console application.

Microsoft Dynamcis NAV

Add a new file called ‘settings.job’ and enter the following cron expression. The settings will be used for scheduling the job in Azure portal. “0 */15 * * * * “ means execute the job in every 15 minutes.

Microsoft Dynamcis NAV

Build the application.

Microsoft Dynamcis NAV

Now I want to deploy the .NET console application to an Azure App Service as a WebJob. A WebJob looks for specific file type, for example (.exe,.bat,.cmd, etc..). You need to create a file with an extension a WebJob is looking for that executes. Navigates to the folder where the executable is created and create the zip file. The zip file should contain all the dll files, exe file, settings file, job file.

Microsoft Dynamcis NAV

Logon to Azure portal and search for the App Service.

Microsoft Dynamcis NAV

Add new App Service

Microsoft Dynamcis NAV

Select Web App

Microsoft Dynamcis NAV

Open the new app services, select WebJobs and add a new WebJobs.

Microsoft Dynamcis NAV

Microsoft Dynamcis NAV

The webjobs will run every 15 minutes and you can see the logs.

 

Written by Manoj Baby, Dynamics NAV Consultant

Email UsEmail Us
Call UsCall Us
RequestRequest Contact
X