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,
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.
Allow us to run the created utility from the command immediate as under,
We have to create a “Run.Cmd” file and add the under line to it,
Guarantee, this file is copied to the output and has a “UTF-8” encoding. This may be confirmed and set from Notepad++ as under,
We are actually able to publish this file in launch mode. Open the Terminal as under,
And run the under command,
dotnet publish -c launch
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,
Open the App Service within the Azure Portal and choose “WebJobs” within the left aspect menu as under,
Add the WebJob as above and save.
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,
Therefore, we see that our Internet Job was executed.
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!