Bots Bot框架仿真器错误:POST 500 directline postActivity
我正在尝试将Microsoft机器人模拟器连接到Azure中的远程机器人 当我在本地运行我的bot时,它会按预期工作,但是当我在Azure中设置新配置以连接到“Web app bot”时,我得到如下错误Bots Bot框架仿真器错误:POST 500 directline postActivity,bots,direct-line-botframework,webbot,Bots,Direct Line Botframework,Webbot,我正在尝试将Microsoft机器人模拟器连接到Azure中的远程机器人 当我在本地运行我的bot时,它会按预期工作,但是当我在Azure中设置新配置以连接到“Web app bot”时,我得到如下错误 [16:05:17]Error: The bot is remote, but the service URL is localhost. Without tunneling software you will not receive replies. [16:05:17]Connectin
[16:05:17]Error: The bot is remote, but the service URL is localhost.
Without tunneling software you will not receive replies.
[16:05:17]Connecting to bots hosted remotely
[16:05:17]Edit ngrok settings
[16:05:17]->messagehi
[16:05:17] POST 500 directline.postActivity
我在ngrok设置中尝试了不同的选项,并遵循了这篇文章()。然而,我仍然得到了错误。以下是emulator inspector json中的日志详细信息
"{\r\n \"message\": \"An error has occurred.\",\r\n \"exceptionMessage\":
\"An error occurred while sending the request.\",\r\n \"exceptionType\":
\"System.Net.Http.HttpRequestException\",\r\n \"stackTrace\": \" at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task <>c__DisplayClass11_0.<<SendAsync>b__1>d.MoveNext()\\r\\n--- End of stack
trace from previous location where exception was thrown ---\\r\\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task)\\r\\n
“{\r\n\”消息\:\”出现错误。\”,\r\n\“exceptionMessage\”:
\发送请求时出错。\,\r\n\“exceptionType\”:
\“System.Net.Http.HttpRequestException\”,\r\n“stackTrace\”:\”位于
System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务c_uDisplayClass11_0.d.MoveNext()\\r\\n--堆栈结束
以前引发异常的位置的跟踪---\\r\\n
System.Runtime.CompilerServices.TaskWaiter.ThrowForNonSuccess(任务
任务)\\r\\n
期望值:
您不能将Azure提供的消息传递端点用于您的bot(“xxxxxx.azurewebsites.ner/api/messages”)Emulator中。Emulator用于测试本地存储的bot。但是,您可以通过ngrok隧道将本地bot连接到Azure托管的bot,以访问外部服务和通道。这允许您在将bot发布到Azure之前测试代码 首先,使用ngrok创建隧道(您可以根据需要更改端口)。要创建该隧道,请运行以下cli命令: ngrok http 3978-host header=“localhost:3978” 这将产生一个转发(即隧道)地址,该地址如下所示:
https://h8g56dq.ngrok.io
复制“https”地址
接下来,使用上面的地址将Azure托管的bot中的消息传递端点替换为附加的“api/messages”。输入后应如下所示:
https://h8g56dg.ngrok.io/api/messages
在Emulator中,将地址设置为上述地址。同时输入您的AppId和AppPassword,否则您将收到401未经授权状态代码
此时,在本地bot运行的情况下,您将能够通过Emulator进行连接
希望有帮助