Bot仿真器连接到另一台机器上的Node.js服务

我有一个在Linux桌面上运行Bot Builder代码的Node.js服务。 我有一个MSFT机器人模拟器运行在我的Mac上,与桌面在同一个公司networking上。

我不能让bot模拟器连接到Node.js服务的callback。 我安装了ngrok v2.1.18,仿真器(应用程序设置)configuration了ngrokpath; 但我不断收到一条错误消息,我需要为callbackURLconfigurationngrok。

从Bot仿真器日志中, ngrok无法启动此错误:

无法启动ngrok:panic:运行时错误:无效的内存地址

我没有使用ngrok,但我find了一个黑客解决scheme。

打开文件botframework-emulator.app/Contents/Resources/app/app/server/botFrameworkService.js并更改:

 this.localhostServiceUrl = `http://localhost:${port}; 

至:

 const hostname = os.hostname(); this.localhostServiceUrl = `http://${hostname}:${port}`; 

不要忘记导入os模块:

const os = require("os");