Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

asp.net - C# Bot framework - Resource not found Error

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

I get an error saying

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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. 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 enter image description here
  4. Copy the Secret key and the Embed code.
  5. Click Done

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...