C#Bot框架-找不到资源错误 [英] C# Bot framework - Resource not found Error

查看:91
本文介绍了C#Bot框架-找不到资源错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Bot框架构建了一个小型的基本Web Bot应用程序,并希望将其部署在Azure上.我已经按照所有步骤进行操作,并且在Azure Portal的在Web聊天中测试"下也可以正常工作,但是当我打开机器人的端点

I've built a small basic web bot app using bot framework and want to deploy it on Azure. I've followed all the steps and it's working fine under "Test in Web Chat" of Azure Portal too, but however as I open my bot's endpoint

https://optlbot.azurewebsites.net/api/messages

我说一个错误

The requested resource does not support http method 'GET'

有人可以帮助我吗,我根本无法调试我的应用程序.我也在模拟器上进行了测试,效果也很好.

Can somebody please help me, I can't debug my application at all. I've also tested on emulator and there too it's working fine.

推荐答案

是的,URL https://optlbot.azurewebsites.net/api/messages 仅适用于 POST 请求,而不适用于 GET 请求,因为您发布从用户到机器人的消息,而不是获取消息,您可以在MessagesController代码中看到它.

Yes, the URL https://optlbot.azurewebsites.net/api/messages works only for POST request and not a GET request, because you post a message from user to bot and not a get, you can see that in the MessagesController code.

要说的是,如果要在本地测试您的机器人,则必须使用仿真器.您可以查看启动模拟器相同.

Being said that, if you want to test your bot locally, you have to use the emulator. You can have a look at Bot emulator for the same.

现在,如果您要将Bot发布给全世界,以便其他人可以看到并使用它,那么这就是该频道的所在.考虑将Channel作为一种媒介,您可以通过该媒介使Bot供其他人使用更好的用户体验.

Now if you want to publish the bot to the world so that others can see it and use it, so that's where the channel comes in. Consider channel as a medium by which you enable your bot for others to use with a much better user experience.

可以通过多种渠道发布该机器人,是的,您可以在所有渠道中发布同一机器人.

There are multiple channels available for the bot to be published in, and yes you can publish the same bot in all the channels.webchat is just one channel and the one which is enabled by default and the way to see it is :

  1. 在Azure门户中打开您的漫游器,然后单击 Channels 刀片.
  2. 点击编辑进入网络聊天频道
  3. 秘密键下,单击显示作为第一个键
  4. 复制秘密密钥嵌入代码.
  5. 点击完成
  1. Open your bot in the Azure Portal and click Channels blade.
  2. Click Edit for the Web Chat channel
  3. Under Secret keys, click Show for the first key
  4. Copy the Secret key and the Embed code.
  5. Click Done

因此,嵌入代码实际上是一个iframe,您可以将其放置在您的网站中或与其他想使用您的漫游器的人共享.或者,您也可以使用iFrame的src直接到达机器人.

So the embed code is actually an iframe which you can place in your website or share with others who want to use your bot. Or you can use the src of the iFrame too to reach the bot directly.

同样,这只是一个频道.您可以查看配置渠道文档以获取在更多渠道(如Skype,Microsoft Teams,电子邮件,Facebook,Slack,Telegram等)中启用漫游器的步骤.

Again this is just one channel. You can take a look at the Configure channels documentation for steps to enable the bot in more channels like Skype, Microsoft Teams, Email, Facebook, Slack, Telegram, etc.

这篇关于C#Bot框架-找不到资源错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆