13

Easy Replication

  1. Create a new project 'ASP.NET Web Application (.NET Framework).
  2. Build compile, update NuGet, all works.
  3. Add: Add New Azure WebJob Project.
  4. Build, compile. Happy
  5. Update NuGet for the WebJob project.
  6. Project no longer compiles.

Breaking changes were introduced https://github.com/Azure/app-service-announcements/issues/129

So I install

Microsoft.Azure.WebJobs.Extensions.Storage

This resolves QueueTriggerAttribute

But in program.cs

    static void Main()
    {
        var config = new JobHostConfiguration();

        if (config.IsDevelopment)
            config.UseDevelopmentSettings();

        var host = new JobHost(config);
        host.RunAndBlock();
    }

I am encountering the following problems:

  1. JobHostConfiguration is now missing.
  2. JobHost constructor now has two parameters, including a new IJobHostContextFactory?
  3. RunAndBlock is missing. It is now 'StartAsync'
  4. The code now needs to become asynchronous since there are no synchronous calls to the job.

Questions:

  1. What additioanl assemblies need to be installed?
  2. What is this new JobHostContextFactory?
  3. How do I configure the job now?
  4. How should I update the code for asynchronous?
  5. How do I block for a continuous job now that all we have is Start?

Thanks in advance!

  • C#
  • .Net Framework 4.6.2
  • Visual Studio 2017 - v15.8.7
Md Farid Uddin Kiron
  • 16,817
  • 3
  • 17
  • 43
Phillip Davis
  • 315
  • 3
  • 15
  • Here is a great example to get up and running with a simple .NET V3 WebJob with a TimerTrigger: https://stackoverflow.com/questions/57264806/scheduled-net-webjob-v3-example?noredirect=1&lq=1 – nmit026 Jul 31 '19 at 00:04

1 Answers1

11

The 3.0.0 NuGet package update (non-beta) brought breaking changes. It's based on the generic host which is similar to the asp.net host. Here's an example of the new setup

Here you can find a GitHub discussion related to that topic.

Mando
  • 11,414
  • 17
  • 86
  • 167