小编Moh*_*hit的帖子

“无法发布活动。未经授权”从机器人模拟器测试时

在 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);
    }
Run Code Online (Sandbox Code Playgroud)

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

bots botframework

10
推荐指数
2
解决办法
4131
查看次数

标签 统计

botframework ×1

bots ×1