Azure

Utilizing Internet Jobs In Azure App Providers

Introduction

In the present day we are going to look into Internet Jobs in Azure App Providers. These are standalone purposes that we will run throughout the context of an Azure Software service. These are helpful for creating monitoring jobs and many others. that can run independently of the primary utility. So, allow us to start.

Creating the Internet Job

We shall be creating the Internet Job in Visual Studio 2022 Neighborhood Preview version utilizing .NET 6 preview model. A Internet Job is only a easy console utility and shall be created as under,

Using Web Jobs in Azure App Services

Using Web Jobs in Azure App Services

Using Web Jobs in Azure App Services

Using Web Jobs in Azure App Services

Replace the code as under within the Program.cs file,

Console.WriteLine("Good day, Working as WebJob from Azure App Service!");

Subsequent, run the applying regionally to make sure all works superb.

Using Web Jobs in Azure App Services

Allow us to run the created utility from the command immediate as under,

Using Web Jobs in Azure App Services

We have to create a “Run.Cmd” file and add the under line to it,

dotnet AzureWebJob.dll

Guarantee, this file is copied to the output and has a “UTF-8” encoding. This may be confirmed and set from Notepad++ as under,

Using Web Jobs in Azure App Services

We are actually able to publish this file in launch mode. Open the Terminal as under,

Using Web Jobs in Azure App Services

And run the under command,

dotnet publish -c launch

Using Web Jobs in Azure App Services

Lastly, zip the publish folder as “Publish.zip” created within the output and you might be able to deploy the net job to Azure.

Deploying the Internet Job

We are going to now deploy the net job we created to an Azure App service. I’ve already created an App service which is an online app as under,

Using Web Jobs in Azure App Services

Open the App Service within the Azure Portal and choose “WebJobs” within the left aspect menu as under,

Using Web Jobs in Azure App Services

Add the WebJob as above and save.

Using Web Jobs in Azure App Services

Run the Internet Job and you’ll get a message that it ran efficiently. Because the job merely outputs a line to the console, open the net jobs logs and you will notice the under,

Using Web Jobs in Azure App Services

Therefore, we see that our Internet Job was executed.

Abstract

On this article, we checked out making a easy net job and deploying it in an Azure App service. The instance was easy however explains the general course of we have to comply with if we wish to create such an artifact for our Azure App service answer. Completely satisfied coding!

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button