azure - V2 Azure Function ServiceBusTrigger 不工作

标签 azure azure-functions azureservicebus

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

[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)

我已将跟踪设置为详细,但无法获取有关此 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" />

最佳答案

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

关于azure - V2 Azure Function ServiceBusTrigger 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52320445/

相关文章:

azure - Azure PowerShell session 尚未正确初始化。请导入模块并重试

c# - Azure 用于 C# 中的并行数学计算

Azure - 从部署源连接到 VSTS 时出错

Azure函数代理无效的URI : noSlash

Azure Functions 筛选器功能正式发布

azure - 架构问题-Azure服务总线和消息顺序保证

c# - Azure ServiceBus FaultTolerantAmqpObject`1'异常

javascript - Azure 应用程序见解 Node js 模块无法正常工作 - Fetch API 无法加载错误

c# - 函数 '' 的监听器无法启动。 Azure持久功能VS 2022

c# - MVC 中的服务总线 + webjob。将字符串作为消息发送