Reputation: 49
I dont want to use "Azure bot service". I have host bot application to azure, after that got hosted url https://something.azurewebsites.net then registered a bot in bot framework https://dev.botframework.com/bots/new with https://something.azurewebsites.net/api/messages endpoint url, microsoft id and password. I got microsoft Id and password when I create a new registration in app registration on azure portal, Then I used that same Microsoft Id and password in visual studio code and republished. But while testing on bot framework test emulator it shows "Sorry, my bot code is having an issue." and when I am trying on local bot framework emulator with microsoft app Id and password it shows "Cannot post activity. Unauthorized. POST401directline.postActivity" I am using "bot framework" : 3.9 and ".net framework": 4.6
Upvotes: 0
Views: 1566
Reputation: 1347
V3 of Bot Framework SDK is deprecated. It is recommended to use V4. https://github.com/microsoft/BotBuilder-V3/blob/master/README.md
Regarding this:
then registered a bot in bot framework https://dev.botframework.com/bots/new with https://something.azurewebsites.net/api/messages endpoint url, microsoft id and password.
and
I got microsoft Id and password when I create a new registration in app registration on azure portal
These are redundant steps. Really, what you should be doing is creating a Bot Channels Registration
in the Azure portal or using az bot
CLI.
I dont want to use "Azure bot service
This does not make sense. Can you further explain what you mean by this? Those two steps you did above are doing exactly that; creating a Bot Channels Registration
. "Typical" bots are two parts; a Bot Channels Registration
(to allow connection to your bot from multiple places, take care of authentication, etc) and a web application (your bot code). Which one do you not want to use?
Regarding the emulator/authentication configuration:
I'm sure you know this, but I wanted to confirm that you are aware of the behavior of appid/password in a bot. Also for the benefit of others that might not be.
You can test with the emulator against a localhost running bot or a deployed bot. When testing with a localhost bot, you can test with appid/password or without. If you test without, you must make sure that they are not configured in the appsettings.json (in v4. other versions, etc. may use different configuration types) and not supplied in launching the bot in emulator. If you test with; you must configure in the appsettings.json and supply them when launching the bot in emulator.
Now let's move on to testing the online/deployed bot. In a deployed bot, it will either pick up the appid/password in the appsettings.json or from configuration in the Web App/App Service's settings. These settings must be titled MicrosoftAppId
and MicrosoftAppPassword
.
So...all this being said, my assumption is that you created two applications (AAD app), and might be mixing up the appid/password. Either that, or it is not quite configured correctly in the Web app (https://something.azurewebsites.net); either in configuration file or in configuration settings in Azure.
I do hope this helps.
Upvotes: 1