Kelsey Kelsey - 3 months ago 66
C# Question

Bot Framework portal - "Test connection to your bot" 401 Unauthorized

I created a bot application which I've successfully been able to test locally via the emulator.

Following https://docs.botframework.com/en-us/csharp/builder/sdkreference/gettingstarted.html I published the Bot Application to Azure. (which is created as http://mybotappname.azurewebsites.net)

I then went to the Microsoft Bot Framework portal at https://dev.botframework.com and registered the bot, and made sure to set the messaging endpoint to

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

After successfully registering, I updated the MicrosoftAppId & MicrosoftAppPassword keys in web.config.

However, when I try to "Test connection to your bot", all I'm seeing is a message saying

"Unauthorized"

How can I debug where this is coming from?

I've tried running the Bot Framework Channel Emulator, setting the Bot Url to the same url as my Bot has set for Messaging endpoint. This gives me a "401 Unauthorized" message as well, but I can't figure out how/where to debug the reason.

Has anyone experienced this or know what I can do to debug?

Thanks

Answer

Figured it out:

In web.config, the default appSetting keys are

<add key="AppId" value="ID" />
<add key="AppSecret" value="SECRET" />

And in the documentation, we set:

<add key="MicrosoftAppId" value = "ID" />
<add key="MicrosoftAppPassword" value = "SECRET" />

My issue was not updating these appSetting keys to MicrosoftAppId and MicrosoftAppPassword. Once I did this, it worked.