c# - 基于 Microsoft Bot Framework 连接到本地 echo bot 的离线直连路由
问题描述
我想使用托管在本地环境中的 pierre3 提供的 API 包装器创建一个 Line 消息传递机器人。
Line Messaging Service ~~POST~~> WebApi.Net ~X-> Offline-Directline ---> Echobot (Bot Framework)
我正在使用节点包“offline-directline”,它应该能够将消息路由到本地机器人,该机器人是从 Microsoft BotFramework Extension 中捆绑的 Echobot 模板创建的。
这是节点终端上打印的文本:
Offline-Directline: Listening for messages from client on http://127.0.0.1:3000
Routing messages to bot on http://localhost:3978/api/messages
到目前为止,我的 webapi 能够接收来自 Line Messenging Service 的请求。
问题是我不知道如何从 webapi 连接到离线直连。
DirectLineClient 不会抛出异常,但是每当 webapi 执行 StartConversationAsync() 时,会话总是返回 null。
我可以确认我的 Echobot 正在工作,因为我可以使用 Bot Framework Emulator 与之交互。
var uri = new Uri("http://localhost:3978/api/messages");
var cred = new DirectLineClientCredentials(null, http://localhost:3000/directline");
this.dlClient = new DirectLineClient(uri, cred);
var conversation = await dlClient.Conversations.StartConversationAsync();
//this is always return null
我希望当我通过 Line Messenger 发送文本“hello world”时,机器人会在 Line Messenger 上回复相同的文本“hello world”。
对于额外的信息,我不确定这是否相关:Line Messaging Api Wrapper 需要使用 Azure blob 存储。我没有在线 Azure Blob 存储,而是使用存储模拟器并将连接字符串设置为“UseDevelopmentStorage=true”。我认为这是有效的,因为我检查了 CloudBlobClient 的实例不为空,并且它包含指向本地模拟器的有效 uri。
--
我已经坚持了好几个小时但没有任何线索。任何帮助将非常感激。
解决方案
推荐阅读
- javascript - 如何使用 moment 插件将分钟转换为 HH:mm
- python-3.x - 如何对 Python 程序进行安全加固?
- python - 在 Django 中使用 managed=False 索引模型和模型字段
- javascript - 输入生成意外的逗号作为值
- reactjs - Storybook 命名为默认导出
- firebase - 带有 FireStore 的 Flutter 聊天模块
- excel - 如何使用 VBA 和选择器将此网站的内容转换为 Excel?
- postgresql - 使用气流的 postgres 数据库获取应用程序数据
- numpy - 迭代数组列并垂直堆叠它们的最快方法
- reactjs - 在 React-css 中,Bootstrap 影响另一个类组件