c# - Azure Functions无法将队列绑定(bind)到CloudQueue类型

标签 c# azure azure-functions azure-storage-queues

我从也需要 CloudQueue 绑定(bind)的 QueueTrigger 函数收到此错误。

Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:索引方法“QueueInstancesToImport.Run”出错 ---> System.InvalidOperationException:无法将队列绑定(bind)到类型“Microsoft.WindowsAzure.Storage.Queue”。云队列'

根据文档 CloudQueue 应该有效。

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue

我发现的其他潜在解决方案不完全匹配或没有帮助。

我的代码

public static class QueueFormInstancesToImport
{
    [FunctionName("QueueFormInstancesToImport")]
    public static async Task Run(
        [QueueTrigger("import-queue")]string message,
        [Queue("import-queue")]CloudQueue queue,
        TraceWriter traceWriter,
        ExecutionContext context)
    {
        // Body of function
        ...
    }
}

最佳答案

这很可能是 nuget 包冲突。 “CloudQueue”参数所来自的程序集版本是与底层函数运行时使用的存储库版本不同的版本。 您可以在 CloudQueue 定义上按 F12 来查看它所绑定(bind)的完整程序集版本。

您很可能添加了对 Azure 存储 SDK 的额外引用。删除额外的引用,仅使用 Azure Functions 模板中的引用。

关于c# - Azure Functions无法将队列绑定(bind)到CloudQueue类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46812713/

相关文章:

c# - 使用 http 触发的函数将输入绑定(bind)到表存储

c# - 让代码知道 ASP.NET 5 应用程序是自托管还是在 IIS 上运行的 CoreCLR 解决方案?

azure - Azure 上的 Kubernetes nginx 入口 Controller 无法访问

powershell - 使用 Powershell 获取 Azure Function 路由参数(段)

Azure逻辑应用程序计算价格

azure - 如何在 Azure CDN 上设置重写规则以提供与路径模式不匹配的 index.html?

node.js - 在 Azure Functions 上部署 Node 应用程序

c# - string.substring 与 string.take

带有 Bootstrap 的 C# ASP.NET

c# - 使用 Twitter API 1.1 oAuth 验证和请求用户的时间线