Publish bot to Azure

荒凉一梦 提交于 2020-01-06 06:55:46

问题


When I published my bot to Azure from Visual Studio and trying it on the web chat, it says can't send the message. Running the bot locally everything works just fine.

The emulator reports HTTP 500 error when trying to chat with the endpoint on azure.


回答1:


After some discussions in the comment section, I've pulled your code from the repository you've provided. Different to what you were saying, it also crashes locally with HTTP 500 on start. Reading the logs gave me issues with web.config.

This leads me to the following solution:

Your codebase contains a web.config file which doesn't belong there. This is a .net core application and therefore should not rely on web.config and instead use appsettings.json. When this web.config gets deployed, the runtime tries to load certain things and crashes with HTTP 500.

Not sure where this web.config comes from but I assume from previous deployments or some test of yours. I've send you a PR simply removing this web.config and deployed your bot to Azure.

It works well:

Make sure you've selected remove additional files at destination when you publish it from Visual Studio after removing web.config. This way you're making sure that you not accidentally leave an orphaned web.config there.




回答2:


While your question is missing detailed information's, I know from experience that most people forget to include a bot state when they deploy the bot on azure.

Bot State Service retired on March 31st, 2018. Therefore most samples on the web are missing state storage when running it on Azure giving you HTTP 500, while it will work locally.

For a solution see my recent answer here on stack overflow.




回答3:


Http 500 error is a very general internal server error. You can add some exception handling logic and log it into Application Insights.

You can refer to the documents https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-trace-logs



来源:https://stackoverflow.com/questions/55578166/publish-bot-to-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!