Azure Function 2 - 缺少using指令或程序集引用?

问题描述 投票:0回答:1

我使用Visual Studio 2017创建了Azure Function v2。

我创建了一个新的队列触发器功能。

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace Functions
{
    public static class queue
    {
        [FunctionName("queue")]
        public static void Run([QueueTrigger("myqueue-items", Connection = "test")]string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
        }
    }
}

但无法找到QueueTrigger的程序集

Error   CS0246  The type or namespace name 'QueueTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?)
Error   CS0246  The type or namespace name 'QueueTrigger' could not be found (are you missing a using directive or an assembly reference?)
Error   CS0246  The type or namespace name 'Connection' could not be found (are you missing a using directive or an assembly reference?)
azure-functions .net-assembly
1个回答
1
投票

正如Nkosi所说,你可以去Azure Queue storage bindings for Azure Functions检查你是否配置了绑定扩展。

对于您的信息,我认为您需要安装Microsoft.Azure.WebJobs.Extensions.Storage NuGet包,版本3.x.一切都会好起来的。

© www.soinside.com 2019 - 2024. All rights reserved.