我正在尝试在 Azure Functions 中使用新的 Durable Functions 扩展,我在 Function 项目上安装了此 Nuget 包:
Microsoft.Azure.WebJobs.Extensions.DurableTask
然后在我的函数中使用 DurableOrchestrationContext,如下所示:
[FunctionName("StopVM")]
public static void StopVM([TimerTrigger("0 */2 * * * *")]TimerInfo myTimer, ILogger log, ExecutionContext context, DurableOrchestrationContext orchestrationContext)
{
....
}
但是当我运行该函数时显示此错误:
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.).
我是否缺少一些步骤,例如向启动类添加任何中间件等,导致文档没有清楚地显示如何使用它?
最佳答案
我明白了。如果您希望它启动 Orchestration 本身或包装 DurableOrchestrationContext
类型的参数,则应使用此属性[OrchestrationClient]
包装 DurableOrchestrationClient
类型的参数> 使用此属性 [OrchestrationTrigger]
来使用上下文,这里有更多详细信息 ( link )
关于c# - 在 Azure Functions 中使用 DurableOrchestration 时,无法将参数 'orchestrationContext' 绑定(bind)到类型 DurableOrchestrationContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53398214/