Bot works in Bot Framework Emulator on local compu

2020-05-06 00:52发布

问题:

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?

回答1:

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:

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

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