The code example of "How to run Durable functions as WebJobs" at, https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-webjobs-sdk, has a bug when following the code example for WebJobs 3.x.
JobHost no longer works. And when the new 3.0 HostBuilder is used the old code for Durable Task Initialization complains it is being depricated. The old code is below:
config.UseDurableTask(new DurableTaskExtension
{
HubName = "MyTaskHub",
});
Could you please provide a code example of how to setup the Durable Task Extension in WebJobs 3.0? At minimum I need to provide a hub name.
Also note your samples are not up-to-date with your latest release 1.7.1 and there is nothing on the web on this that I can find.
Thanks, George.
PS I have filled out the relevant items below.
Describe the bug See above.
A clear and concise description of what the bug is. Please make an effort to fill in all the sections below; the information will help us investigate your issue.
Investigative information See above
Durable Functions extension version: 1.7.1
Function App version (1.0 or 2.0): MS.Azure.WebJobs.Extensions 3.0.1, MS.Azure.WebJobs 3.0.3
If JavaScript
If deployed to Azure On Desk Top only
If you don't want to share your Function App name or Functions names on GitHub, please be sure to provide your Invocation ID, Timestamp, and Region - we can use this to look up your Function App/Function. Provide an invocation id per Function. See the Functions Host wiki for more details.
To Reproduce -- Run the example code in main() in your documentation I cited at the beinning.
Steps to reproduce the behavior:
While not required, providing your orchestrator's source code in anonymized form is often very helpful when investigating unexpected orchestrator behavior.
Expected behavior
A clear and concise description of what you expected to happen.
Actual behavior
A clear and concise description of what actually happened.
Screenshots
If applicable, add screenshots to help explain your problem.
Known workarounds
Provide a description of any known workarounds you used.
Additional context
I got sample code working that uses the Durable Task Extension 1.7.1 hosted in WebJobs 3.x, as follows. Perhaps this will aid you in updating your sample and also aid others trying to figure out how to do it in the mean time. George
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
static void Main(string[] args)
{
var hostBuilder = new HostBuilder()
.UseEnvironment("Development")
.ConfigureWebJobs(config =>
{
config.AddAzureStorageCoreServices()
// Configure Queue Trigger of local Functions.
.AddAzureStorage(options =>
{
options.BatchSize = 1;
options.MaxPollingInterval = TimeSpan.FromSeconds(5);
options.VisibilityTimeout = TimeSpan.FromSeconds(15);
}
);
// Enable Timer Trigger of local Functions.
config.AddTimers();
// Enable Durable Task Extensions hosted in WebJobs for Durable Task Orchestrations.
config.AddDurableTask(options =>
{
options.HubName = "MyTaskHub";
options.AzureStorageConnectionStringName = "AzureWebJobsStorage";
}
);
})
.ConfigureLogging((context, logBldr) =>
{
logBldr.SetMinimumLevel(LogLevel.Debug);
logBldr.AddConsole(); // In Microsoft.Extensions.Logging.Console
}
)
.UseConsoleLifetime()
.ConfigureServices((context, localServices) =>
{
// Note: You must have a class named the same as that below which
// contains your functions (that get triggered by queue or timer triggers) and perhaps
// your orchestrators, activities as well.
localServices.AddTransient<DurableFunctionsTest,DurableFunctionsTest>();
// Add other Dependency Injected classes below:
});
var host = hostBuilder.Build();
host.RunAsync().GetAwaiter().GetResult();
}
Hi George,
I have the same issue initializing Durable Tasks in webjob 3.x and i have searched in git repo latest WebJobs.Extensions 3.0.1 and still don't see the extension AddDurableTask
can I know how did you get this and which version were you referring to.
I found that AddDurableTask is available in NETSTANDARD2_0 only.
I have my code running in a .NET Core 2.2 Console App.
You likely are missing a NuGet package. The NuGet packages I am using for this project are shown below:

You may also want to read up on the relationship between .NET Standard and .NET Core -- That might help as well.
Good luck.
George
Also, here are the relevant Usings from my code:
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
hth George
@cgillum I picked this one up, the PR is submitted.
Thanks!
Thanks @CarlosSardo! I added a small comment to your PR. It looks like @ggailey777 was assigned to approve it, and hopefully he can get to that soon. :)
I really appreciate the help.
@cgillum PR is merged and changes are live in docs.
I suggest closing this issue.
Thanks!
Awesome. Thanks Carlos!