gpt4 book ai didi

botframework - "Cannot post activity. Unauthorized"从机器人模拟器测试时

转载 作者:行者123 更新时间:2023-12-03 17:55:30 33 4
gpt4 key购买 nike

在 Bot Emulator 中测试来自 Azure 的 EchoBot 模板时,我不断收到“无法发布事件。未经授权”。我该如何防范?我是 .NET 的新手,所以不明白这里的身份验证是如何工作的。我可以看到正在加载的配置设置,但我看不到它们是如何在 Azure 的默认 EchoBot 模板中提供或应用的。

我发现如果我在 appsettings.json 中定义了“MicrosoftAppID”和“MicrosoftAppPassword”,我只会得到未授权。如果我将这些注释掉,它就可以正常工作。

    [HttpPost]
public async Task PostAsync()
{
// Delegate the processing of the HTTP POST to the adapter.
// The adapter will invoke the bot.
await Adapter.ProcessAsync(Request, Response, Bot);
}

所以我想了解如何避免在本地测试代码时必须注释掉这些行。 PostAsync 返回 401。

最佳答案

您是否尝试在 模拟器 内添加您的 Microsoft App ID Microsoft App Password

在仿真器中测试机器人后,添加它们后应该可以正常工作,请查看下面的图片

enter image description here

关于botframework - "Cannot post activity. Unauthorized"从机器人模拟器测试时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58463852/

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