V2 Azure功能ServiceBusTrigger不起作用

时间:2018-09-13 19:20:22

标签: azure azure-functions azureservicebus

我有一个定义Azure函数的.NET Standard 2.0项目。我有几个BlobTrigger和QueueTrigger函数,它们可以按预期工作。我正在尝试用ServiceBus主题触发函数替换存储帐户QueueTrigger函数:

[FunctionName("CommandConsumer")]
public static async Task RunAsync([ServiceBusTrigger("commands", "active", Connection = "ServiceBus")]string commandJson, TraceWriter log)
{
    log.Info($"C# ServiceBus topic trigger function processed message: {commandJson}");
}

即使上游函数已成功将消息添加到主题,此函数也永远不会被触发(我现在可以看到该主题上有25条消息),并且控制台窗口中显示了很多类似这样的消息:

[9/13/2018 7:13:29 PM] MessageReceiver error (Action=Receive, ClientId=MessageReceiver1commands/Subscriptions/active, EntityPath=commands/Subscriptions/active, Endpoint=p.servicebus.windows.net)
[9/13/2018 7:14:06 PM] MessageReceiver error (Action=Receive, ClientId=MessageReceiver1commands/Subscriptions/active, EntityPath=commands/Subscriptions/active, Endpoint=p.servicebus.windows.net)
[9/13/2018 7:14:42 PM] MessageReceiver error (Action=Receive, ClientId=MessageReceiver1commands/Subscriptions/active, EntityPath=commands/Subscriptions/active, Endpoint=p.servicebus.windows.net)

我已将跟踪设置为Verbose,但是我没有更多有关此MessageReceiver错误的详细信息。

提前谢谢!

编辑:这是项目的相关软件包参考:

<PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.0-beta8" />
<PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="3.0.0-beta8" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.19" />

1 个答案:

答案 0 :(得分:1)

我们在Azure模板中犯了一个错误,并为某些KeyVault访问密钥重复了密钥,由于对KeyVault的“访问被拒绝”,导致Azure函数的调用失败。不幸的是,在本地运行时,输出窗口没有显示这些内部异常,但是当我们在Azure中运行相同的代码时,我们在Live Metrics Stream中看到了这些异常,并且能够跟踪并修复重复的键。