azure-webjobs - Microsoft.Azure.WebJobs.Host:无法将参数“$return”绑定到布尔类型
问题描述
我该如何解决 ?:/
public static async Task<bool> Run([QueueTrigger("<queueNameHere", Connection = "<connectionHere>")]byte[] myQueueItem, TraceWriter log)
导致错误:
Microsoft.Azure.WebJobs.Host: Error indexing method 'Run'.
Microsoft.Azure.WebJobs.Host: Cannot bind parameter '$return' to type
Boolean&. Make sure the parameter Type is supported by the binding. If
you're using binding extensions (e.g. ServiceBus, Timers, etc.) make
sure you've called the registration method for the extension(s) in
your startup code (e.g. config.UseServiceBus(), config.UseTimers(),
etc.).
解决方案
该错误源于您试图将返回类型设置为布尔(任务),我相信 QueueTriggered 函数只能具有 void 返回类型。所以只需删除返回类型:
public static async Task Run(...)
您尝试返回类型是否有特定目的?如果您尝试将状态传达给另一个进程,那么您应该考虑另一种方法,例如通过输出绑定将完成的消息放在另一个队列中或更新数据库中的状态等。
推荐阅读
- c# - 从 C++ 到 C++/CLI 到 C# 检索 wchar_t*
- c++ - 如何修复我收到的未定义引用的以下错误
- python - 在 wait() 上使用 Python 多处理库错误的并行 Cassandra 请求
- openssl - x509 结构在 openSSL 1.1.1k 中不再可访问
- javascript - 在数组中构造多个对象
- php - 获取当前url路径
- c - 如何最好地复制最大成员未知的工会
- node.js - 将 Angular 8 和 NodeJS 应用程序自动部署到 Heroku
- python - 当逻辑在其他地方使用并且没有问题时,为什么我在这行代码中出现错误?
- python - Pandas - 合并数据帧 - MemoryError:无法分配