gpt4 book ai didi

azure - 通过 HTTP 使用 ServiceBusTrigger 调用 Azure 函数会抛出 InvalidOperationException

转载 作者:行者123 更新时间:2023-12-02 23:45:35 25 4
gpt4 key购买 nike

在我们的部署环境中,我们将有一个通过 ServiceBus 触发的 Azure Function,这非常棒。但对于本地测试,我希望能够利用 following article 中的以下建议:

For all kinds of functions other than HTTP triggers and webhooks, you can test your functions locally by calling an administration endpoint. Calling this endpoint with an HTTP POST request on the local server triggers the function. You can optionally pass test data to the execution in the body of the POST request. This functionality is similar to the Test tab in the Azure portal.

但是,当我向 localhost:7071/admin/functions/NameOfMyFunction 发送请求时,Azure 代码中会引发以下异常:

System.InvalidOperationException: 'No authentication handler is configured to authenticate for the scheme: ArmToken'

对于带有 ServiceBusTrigger 的函数,是否需要在此测试 HTTP 帖子上放置一些身份验证 header ?

最佳答案

For functions with ServiceBusTrigger on them, is there some Authentication header that I need to put on this test HTTP post?

很奇怪你得到这个错误。根据我的测试,不需要为其添加身份验证 header 。我用VS 2017测试了一下,在我这边工作正常。

以下是我的详细步骤,您可以引用:

1.创建一个azure函数应用并添加服务总线触发器。

enter image description here

2.用postman测试

post localhost:7071/admin/functions/{functionName}

body

{"input":"Service Bus Message"}

enter image description here

控制台输出: enter image description here

关于azure - 通过 HTTP 使用 ServiceBusTrigger 调用 Azure 函数会抛出 InvalidOperationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50672496/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com