Developing WebJob using .NET Core

To create a Web Job, we can create a .NET class library project, or, if Azure SDK for Visual Studio 2015 is installed, we can select the project Azure WebJob template from the Cloud section, which generates the basic boilerplate code to kick-start the project. However, with .NET Core, there is no tooling support currently provided in Visual Studio 2015 and some manual work is needed. Moreover, Azure WebJobs SDK is also not supported with .NET Core. However, if you want to run your .NET Core console application as a WebJob, it can be done with a few simple steps, as shown next.

For example, if you have a .NET Console application, and you want to run that as a WebJob in the Azure portal, the following steps can be taken:

  1. Create a batch (.bat) file under your console application's netcoreapp folder, and add the following script:
        ECHO OFF 
dotnet YourConsoleApp.dll
  1. Develop a zip package of the netcoreapp folder, and upload it on Azure, as shown in the following screenshot:
  1. Specify the name of the WebJob.
  2. Upload the Zip file created.
  3. Select Type: either Triggered or Continuous.
  4. Select the type of the Triggers: either Manual or Schedule (Schedule triggers need a CRON expression to be set).

The CRON expression includes six fields, which are as follows:

          {second} {minute} {hour} {day} {month} {day of the week}

For Example: 30 */5 * * * *

This means: At 30 seconds past the minute, every 5 minutes.

To use Azure Storage Queues, Service Bus, or other Azure components, we need Azure WebJobs SDK, which is not supported in .NET Core. But we can use .NET Framework 4.5.2 or greater to leverage a particular requirement.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.133.54