【问题标题】:No response from Botbuilder bot on localhost, but works in Azure本地主机上的 Botbuilder bot 没有响应,但在 Azure 中有效
【发布时间】:2019-01-16 07:09:33
【问题描述】:

我正在尝试遵循 this 教程,该教程要求我下载机器人代码,在本地运行它并使用 Botframework 模拟器对其进行测试。当我在模拟器中聊天时,它没有回复。

当我使用 Azure 的网络聊天模拟器时,效果很好!

我在 Azure 上使用 these 指令设置了机器人,因此所有必要的资源都自动启动并运行。当我聊天时,节点控制台会打印以下内容:

警告:ChatConnector:接收 - 模拟器在未启用安全性的情况下运行。 logger.js:24 ChatConnector:收到消息。

有时,它会出错:

错误:无法初始化 Azure 表客户端。错误:错误:无法在 Azure 表上执行请求的操作。消息:连接 ECONNREFUSED 127.0.0.1:10002。错误代码:ECONNREFUSED UniversalBot.js:548

我不知道这是相关的还是单独的问题。

【问题讨论】:

    标签: node.js azure botframework azure-table-storage


    【解决方案1】:

    警告:ChatConnector:接收 - 模拟器在未启用安全性的情况下运行。 logger.js:24 ChatConnector:收到消息。

    这只是一个警告,可能是由于在模拟器中使用 http URL:http://localhost:3978/api/messages 作为消息端点引起的。

    错误:无法初始化 Azure 表客户端。错误:错误:无法在 Azure 表上执行请求的操作。

    如果你检查代码,你会发现它使用 Azure 表存储来存储和管理你的机器人的状态数据:

    var tableName = 'botdata';
    var azureTableClient = new botbuilder_azure.AzureTableClient(tableName, process.env['AzureWebJobsStorage']);
    var tableStorage = new botbuilder_azure.AzureBotStorage({ gzipData: false }, azureTableClient);
    
    // Create your bot with a function to receive messages from the user
    var bot = new builder.UniversalBot(connector);
    bot.set('storage', tableStorage);
    

    代码会使用'AzureWebJobsStorage'连接字符串来发起azureTableClient,如果不提供'AzureWebJobsStorage'的连接字符串,会抛出上述错误。

    请尝试为'AzureWebJobsStorage' 设置环境变量或直接在代码中指定连接字符串。

    var azureTableClient = new botbuilder_azure.AzureTableClient(tableName, '{your_storage_connection_string_here}');
    

    【讨论】:

      【解决方案2】:

      请您试试this。我认为它不起作用,因为您的端点和名称不正确

      【讨论】:

        猜你喜欢
        • 2017-03-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多