当我构建并运行项目时,一切正常。
当我发布项目并从发布目录中运行它时,它不响应任何消息。
在模拟器中,我收到消息:
无法发布活动。未经授权。 POST403 directline.postActivity
dotnet myBot.dll //from within publish directory, bot runs, doesnt repond to any message
dotnet run //from project directory, everything works fine
所以,问题是我试图通过localhost端点测试生产配置,在我的.bot文件中我有这个:
{
"type": "endpoint",
"appId": "myId",
"appPassword": "myPass",
"endpoint": "https://my.azurewebsites.net/api/messages",
"name": "production",
"id": "4"
},
生产端点是天蓝色服务。因此,您要么在localhost上本地测试,要么在Azure上设置服务以指向您的localhost(ngrok提供的链接 - 在这种情况下,您需要配置ngrok以将您的localhost暴露给外部)。
https://blog.botframework.com/2017/10/19/debug-channel-locally-using-ngrok/