Getting started with a new bot
Microsoft decided to start the migration process of all bots created via BotFramework.com. This site could be used to initialize a new bot couple months ago. However, as Azure Bot Services finally went out of preview phase, BotFramework portal is getting withdrawn.
To create a new bot you need to go to Azure Portal, click Add to start adding a new resource and look for a Web App Bot:
Once you click Create you need to fill in all required fields on web app details blade and wait about a minute to have your bot service up and ready. The most basic bot consists of 3 resources:
Downloading bot code
You can test your bot code by accessing the resource of type Web App Bot and heading to Test in Web Chat. The bot deployed by default straight after creating a new bot service uses simple echo bot template. To make it more sophisticated, you can go to Build tab and download the code as a zip file:
500 error after re-deploying the bot
Having implemented some changes in bot code, it’s time to re-deploy it. You can simply right-click on the web api project (the only project in downloaded solution) and use Publish option. As the downloaded project is shipped with publish profile targeting the Azure Bot Service we’ve just created, everything should go smoothly. And it will – assuming you didn’t do some significant changes.
However, things might go worse if you modify your project namespace. The downloaded project has rather ugly one: Microsoft.Bot.Sample.SimpleEchoBot. Once you change it in project properties (change the Assembly name and Default namespace), rebuild and redeploy you might find out that your bot sends 500 error when you start chatting with it:
The errors returned to test channels are not telling us anything.
The solution: clear old binaries!
The reason this happens is the fact you’ve deployed a binary which doesn’t have an old name (SampleEchoBot.dll). As the web application has now a second binary which tries to host a Messages controller. More details can be found when accessing it via web browser:
To fix it you need to modify your publish profile. Click Publish once again, switch to Settings tab, expand the File Publish Options and check the Remove additional files at destination. After another publish you can deselect this option. The bot should respond now as expected.