azure-functions - 绑定类型“serviceBusTrigger”未注册
问题描述
我有一个时间触发的 Azure 函数,我通过它在我的 Azure 服务总线主题中推送一些消息。现在,期望是每当在主题中接收到消息时,它将触发另一个主题触发函数。不幸的是,当我通过服务总线资源管理器工具检查主题订阅中的消息时,它没有显示收到任何消息。我也可以在功能控制台中看到这个错误: The 'myFunc' function is in error: The binding type(s) 'serviceBusTrigger' are not registered. Please ensure the type is correct and the binding extension is installed
我不确定我在哪里出错了。我已经像这样定义了我的主题触发函数:
[FunctionName("myFunc")]
public async Task Run([ServiceBusTrigger("topic-name", "subs-name", Connection = "ServiceBusConnectionString")]string message, ILogger log)
{ ... }
请注意,我已经安装了最新版本的Microsoft.Azure.WebJobs
& Microsoft.Azure.WebJobs.ServiceBus
(但不知道为什么两者都显示警告)。是因为版本有问题吗?
我的主机.json:
{
"version": "2.0",
"logging": {
"logLevel": {
"fun_name": "Information"
}
}
}
解决方案
这是我这边的 .csproj 文件,它在本地运行良好。
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.29" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
应该没有问题,您可能会遇到组件冲突。
推荐阅读
- python - 我的代码有什么问题?它不允许我用箭头键增加和减少心率
- python - WebScraping StockTwits 时出现“NoneType”错误
- python-3.x - 如何在python中初始化一个类,而不是一个实例
- windbg - WinDbg:如何使用伪寄存器在断点 .printf _without_ 中包含线程 ID 和时间值?
- reactjs - 当我构建应用程序时,React Routing 不起作用 - React JS,React Router DOM
- c++ - Boost Gzip分块数据分解
- eclipse - 在 Eclipse 的更新站点中包含一个外部更新站点
- jquery - 通过 jquery 验证 Bootstrap 验证器
- python-3.x - 如何将 z 值插入 x,y 坐标?
- php - 实时拉取API数据并发布