How to deploy and schedule a console application to Azure portal
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).”
Develop your hellow world console application.
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.
Build the application.
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.
Logon to Azure portal and search for the App Service.
Add new App Service
Select Web App
Open the new app services, select WebJobs and add a new WebJobs.
The webjobs will run every 15 minutes and you can see the logs.
No comments:
Post a Comment