c# - 在 Azure Functions 中使用 DurableOrchestration 时,无法将参数 'orchestrationContext' 绑定(bind)到类型 DurableOrchestrationContext

标签 c# azure azure-functions azure-durable-functions azure-triggers

我正在尝试在 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/

相关文章:

.net - Azure 序列化中的 DTO 问题

c# - Azure API 部署问题 - Swashbuckle SwaggenGen 错误

c# - 完成后关闭的新弹出窗口?

c# - 如何将 24 位图像转换为 16 位 rgb565 位图?

azure - 使用 Office 加载项设置 SSO,由于域不匹配,无法使用 SSO 资源 ""

c# - 从 Azure Functions NET5 迁移到 NET6 - 现在如何注册中间件

c# - 将 CosmosDB const 连接字符串注入(inject) Azure Function V4 CosmosDB 输入/输出绑定(bind)?

azure - 如何基于函数槽调用Azure Functions

c# - Windows 中可等待计时器的问题(timeSetEvent 和 CreateTimerQueueTimer)

c# - 为什么程序集似乎被引用但实际上没有