0

Right now, I'm testing the steps required when it comes to starting a bot project in Virtual Studio Community 2019, testing a bot in Bot Framework Emulator (V4), and then deploying that bot to Microsoft Azure.

Right now, I'm testing a simple Echo Bot template available in Virtual Studio Community 2019. When I run it in Virtual Studio Community 2019, open the bot in Bot Framework Emulator using a provided "localhost" URL, and test it in the emulator's "Live Chat" window, it works perfectly fine.

However, after I go through the process of deploying this bot using Azure CLI (command-line tool), I find that the bot doesn't respond when I go to "Test in Web Chat" for the Bot Channels Registration resource, which is named after the BotID. When I look at the channels page, I see the following error: "There was an error sending this message to your bot: HTTP status code NotFound."

I already tried turning on "Always On" for the bot, enabling Application Insights (ASP.NET, ASP.NET Core), and integrating an application insights service with the bot.

I attached an image of the bot's files at https://"botname".scm.azurewebsites.net/dev/wwwroot/ as requested by "mdrichardson - MSFT" in the comment section of the question.

Bot File Directory

How should I resolve this issue?

mdrichardson
  • 7,141
  • 1
  • 7
  • 21
  • Can you post the steps you used to deploy the bot? Are they [these ones](https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-deploy-az-cli?view=azure-bot-service-4.0&tabs=newrg)? My guess is that you didn't correctly zip your local code before running `az webapp deployment...`. Can you screenshot the files you see listed here: `https:/.scm.azurewebsites.net/dev/wwwroot/` – mdrichardson May 20 '19 at 17:22
  • Hi, mdrichardson - MSFT. Thank you for helping with this issue. I added a URL to an image of the bot's files to the original question. Do you see any quick changes I should make based on how it looks? If it looks correct, what are some other approaches I should try? – DataExaminer555 May 20 '19 at 18:03

1 Answers1

0

It looks like you're missing this step:

az bot prepare-deploy --lang Csharp --code-dir "." --proj-file-path "MyBot.csproj"

This creates a .deployment file that gets uploaded when you deploy. Once uploaded, it tells Kudu/Azure to build the bot. It should result in your directory containing a bunch of .dll files, looking more like this:

enter image description here

It's possible that you didn't miss that step, in which case you just need to include the .deployment file in your code.zip and then re-run:

az webapp deployment source config-zip --resource-group "<yourGroup>" --name "<yourBot>" --src "code.zip"

Alternatively...

Since you're using the Visual Studio Template, you can:

  1. Right-click on your project in Visual Studio, go to Publish

enter image description here

  1. Stay on the App Service tab, click Publish, and go through the steps to deploy.

enter image description here

mdrichardson
  • 7,141
  • 1
  • 7
  • 21
  • Hi, mdrichardson - MSFT. I followed the advice regarding Azure CLI and now my file set up looks identical to the file setup in your screenshot. However, I still can't get the to to work in "Test in Web Chat." Now I get this error: "There was an error sending this message to your bot: HTTP status code InternalServerError." – DataExaminer555 May 20 '19 at 19:02
  • Also, I tried publishing from Virtual Studio 2019. It looks dramatically different from the version you're using after pressing "Publish." I get a long error message (too long for this comment) that refers me to this URL: https://learn.microsoft.com/en-us/iis/publish/troubleshooting-web-deploy/web-deploy-error-codes#ERROR_DESTINATION_INVALID – DataExaminer555 May 20 '19 at 19:07
  • "HTTP status code InternalServerError" usually means that the code for your bot is broken, somehow, and won't run. Are you using the EchoBot without any modifications? The publish error seems odd. I've never come across that before. Which of those errors listed on the web page did you receive? I often find it helpful to go to `https://.scm.azurewebsites.net/dev/wwwroot/:vs.output`, and look for errors after clicking Run (on the left), and when using Test in Web Chat. – mdrichardson May 20 '19 at 19:24
  • Are your AppId and Pass correct in App Service > Configuration? Sometimes, when a deployment fails, I start [the deployment docs](https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-deploy-az-cli?view=azure-bot-service-4.0&tabs=newrg) from scratch with a new deployment. Often times, I find that I missed something minor that takes me longer to troubleshoot than it does to just start the deployment over. – mdrichardson May 20 '19 at 19:25
  • @DataExaminer555 See above comments. Forgot that if I don't include `@you`, it won't notify you. – mdrichardson May 20 '19 at 21:30
  • Hi, mdrichardson - MSFT. I didn't seen to get an error when I pressed run at the wwwroot page. "https://"botname".azurewebsites.net/ also seemed to work fine. I'm going to try deploying again from scratch. Also, I'm going to try the templates here: https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore ...thanks, I'll likely have a couple of more questions in the near future. – DataExaminer555 May 21 '19 at 13:23
  • @DataExaminer555 Sounds good. If it's the same issue, just @me here. If not, feel free to make a new StackOverflow question; we look over all the `botframework` tags every morning. – mdrichardson May 21 '19 at 14:46