c# - 当我尝试使用服务总线触发功能时,收到错误消息 "Cannot convert input parameter",为什么?

标签 c# azure azure-functions azureservicebus

有没有办法创建需要 ServiceBusReceivedMessage 对象作为参数的 Azure 函数?像这样:

[Function("Function1")]
public static void Run(
    [ServiceBusTrigger("...", "...", Connection = "...")] ServiceBusReceivedMessage  msg)

我为此类创建了一些扩展方法,因此使用此类对我来说很有用。

我注意到这个教程 Azure Service Bus bindings for Azure Functions

我正在使用 .net 5,并且已通过 nuget 包 Microsoft.Azure.WebJobs.Extensions.ServiceBus 安装了 beta-5 版本,但当我尝试接收消息时,我看到此错误:

Exception: Microsoft.Azure.Functions.Worker.Diagnostics.Exceptions.FunctionInputConverterException: Error converting 1 input parameters for Function 'Function1': Cannot convert input parameter 'msg' to type 'Azure.Messaging.ServiceBus.ServiceBusReceivedMessage' from type 'System.String'.

不确定我是否错过了什么或者是否有可能

最佳答案

Microsoft.Azure.WebJobs.Extensions.ServiceBus 版本 5 旨在与进程内 Functions SDK 配合使用。您的解决方案似乎使用功能隔离工作SDK,它不支持 SDK types截至目前。

关于c# - 当我尝试使用服务总线触发功能时,收到错误消息 "Cannot convert input parameter",为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68454335/

相关文章:

c# - 如何在 Azure 函数签名中使用强类型 http 方法

c# - 在 Azure 函数中使用 RestSharp 调用 HTTPS 会给出 "The SSL connection could not be established"

c# - 屏幕左上角出现动态生成的下拉菜单

performance - 美国哪个 Azure 数据中心在网络延迟方面比其他数据中心具有最佳性能

sql-server - ActiveRecord(无 Rails): How to configure a connection to an azure database

azure - 使用多个实例更新 azure 表中的 40+ 百万个实体如何处理并发问题

azure函数无法从appsettings读取消费者组名称

c# - C#错误: not all code paths return a value. Casting a string to a float

c# - 查找并替换几个词而不影响将来的替换

c# - 在 ASP.NET Web.config 中指定 uploadReadAheadSize