1
votes

I am trying to use the new Durable Functions extension in Azure Functions I installed this Nuget package on my Function project:

Microsoft.Azure.WebJobs.Extensions.DurableTask

And then used the DurableOrchestrationContext in my function like that:

[FunctionName("StopVM")]
public static void StopVM([TimerTrigger("0 */2 * * * *")]TimerInfo myTimer, ILogger log, ExecutionContext context, DurableOrchestrationContext orchestrationContext)
    {
    ....
    }

but when i run the function this error shown:

Error indexing method 'FuncApp.StopVM' [20/11/2018 17:09:01] Microsoft.Azure.WebJobs.Host: Error indexing method 'FuncApp.StopVM'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'orchestrationContext' to type DurableOrchestrationContext. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).

Do i missing some steps like adding any middle-ware to startup class or etc. cause the documentation not shown clearly how to use it?

1

1 Answers

3
votes

I got it. You should wrap your parameter of type DurableOrchestrationClient with this attribute[OrchestrationClient] if you want it to start the Orchestration itself or wrap the parameter of type DurableOrchestrationContext with this attribute [OrchestrationTrigger] to use the context and here there are more details (link)