【发布时间】:2021-07-02 20:20:17
【问题描述】:
我有一个从 Azure 服务总线触发的 Azure 函数。我想在本地测试它并从 Postman 调用我正在运行的 Azure 函数,如下所述:https://docs.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http
似乎我设法从 Postman 调用了我的本地 Azure 函数,因为我得到了 202 Accepted 响应。但是在我拨打电话时在控制台中出现错误:
A ScriptHost error has occurred
Exception while executing function: Functions.MyAzFunction.
Microsoft.Azure.WebJobs.Host: Exception binding parameter 'myBrokeredMessage'.
Microsoft.Azure.WebJobs.ServiceBus: Unable to convert trigger to BrokeredMessage.
当我尝试调试时,它甚至不会停在第一行:
public static async Task Process(BrokeredMessage myBrokeredMessage, Binder binder, TraceWriter log)
{
var foo = "bar";
// real code...
}
我应该把什么作为 http 请求的主体,才能到达第一行?还是别的什么?
【问题讨论】:
-
您使用的是哪个版本,v1 还是 v2? Azure Functions v2 不再使用 BrokeredMessage。
-
这是版本 1。
标签: c# azure postman azure-functions azureservicebus