Unexpected bot behavior after deploying to Azure (Bot emulator works without APP Id - Password and "failed [500] Internal Server Error" with it
Hi experts,
We have been developing a bot using some samples and the Bot Framework SDK on VS2015. The Bot is conformed by different VS projects based on some design principles that we define
-
When we test the bot on the Bot Framework Emulator LOCALLY it works fine
-
After the bot deployment on Azure (http://botmsar.azurewebsites.net/api/messages) the Bot Acknowledges the connection but after the first post, it throw a [500] Internal server error message [19:06:59] -> POST 200 [conversationUpdate]
[19:06:59] -> POST 200 [conversationUpdate]
[19:07:03] -> POST Request to 'http://botmsar.azurewebsites.net/api/messages' failed: [500] Internal Server Error -
We notice that if we try to connect to the bot using just the URL without the ID and password it works.

-
Even that it is working without those parameters, we think that it won't be working correctly on other apps, since it also throws an error on the bot framework test option and since it is not working on skype channel.

I hope you can guide me on what's going on. If you need the source code, please let me know.
The 500 is coming from your bot. Can you log errors in your bot to see what the error is? I suspect it may be that you need to add a call to TrustServiceUrl. See https://github.com/Microsoft/BotBuilder/issues/3329#issuecomment-322570247
A deployed bot that has no appid or password will still function with the emulator. Have the MicrosoftAppId and MicrosoftAppPassword been set in the web.config? (for a .net sdk bot) Or, you can also supply these in Azure's App Settings.
@EricDahlvang I have tried both ways and the error persist. It seems it is more related with the thread suggested by @danmarshall . Could you please provide me more insights of why the TrustServiceUrl os required? Thanks
@iamthewall TrustServiceUrl is part of Bot Authentication in the .net sdk. MicrosoftAppCredentials only sets the Authorization header when the ServiceUrl is trusted, and the ServiceUrl is only considered to be trusted when it is in the TrustedHostNames: https://github.com/Microsoft/BotBuilder/blob/e133266e9754b3f0bd8b992e078237ee7bcb963a/CSharp/Library/Microsoft.Bot.Connector.Shared/MicrosoftAppCredentials.cs#L157 The ServiceUrl is added to the TrustedHostNames when the BotAuthenticator has validated the token: https://github.com/Microsoft/BotBuilder/blob/719a89e0a74c1114a4c82ccf77c8c8ae09af3ed7/CSharp/Library/Microsoft.Bot.Connector.Shared/BotAuthenticator.cs Or, when the developer specifically calls TrustServiceUrl.
@EricDahlvang Hi Eric, I am trying to build a bot and log the conversation to my Azure SQL DB. I have followed the steps on https://blog.botframework.com/2017/05/05/Saving-Bot-Actions-On-Azure-Sql-Server/
I am getting an error of Request to 'https://botapplicationsqlexample.azurewebsites.net/api/messages' failed: [500] Internal Server Error . The conversation is getting stored on the DB but no reply from the Bot's end is coming, rather 500 error is being shown. Could you please help me with it?
Hi @Muskan-14
I'm sorry you've run into issues with the blog post. Please try running the bot locally, and debugging the code using the emulator. This document explains how to setup the emulator for local debugging: https://docs.microsoft.com/en-us/bot-framework/bot-service-debug-emulator
This repository is for issues with the BotFramework-Emulator. If you require further assistance, please ask your question on StackOverflow with the BotFramework tag, or the BotBuilder GitHub repository.
Closing this issue due to age and no activity.