Bot框架WebChat失败[405]方法不允许

问题描述 投票:0回答:1

我们使用Microsoft Bot Framework NodeJS Template开发了一个Chatbot。我们部署到Azure。在打开输出控制台时,我们看到以下错误:

Bot源代码:

var restify = require('restify');
var builder = require('botbuilder');

// Setup Restify Server
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
   console.log('%s listening to %s', server.name, server.url); 
});

// Create chat connector for communicating with the Bot Framework Service
var connector = new builder.ChatConnector({
    appId:My APP ID',
    appPassword:My APP Password
});

// Listen for messages from users 
server.post('/api/messages', connector.listen());

// Receive messages from the user and respond by echoing each message back (prefixed with 'You said:')
var bot = new builder.UniversalBot(connector, function (session) {
    session.send("You said: %s", session.message.text);
});

的package.json

{
  "name": "",
  "version": "",
  "dependencies": {
    "botbuilder": "^3.15.0",
    "restify": "^7.2.1"
  }
}

控制台输出

        Error: GET to 'https://state.botframework.com/v3/botstate/webchat/conversations/0560d6047ba0487bd762e7e86a1b6ca/users/A8r4akHZE1Z' failed: [405] Method Not Allowed
    at Request._callback (D:\home\site\wwwroot\node_modules\botbuilder\lib\bots\ChatConnector.js:647:46)
    at Request.self.callback (D:\home\site\wwwroot\node_modules\request\request.js:185:22)
    at emitTwo (events.js:106:13)
    at Request.emit (events.js:191:7)
    at Request. (D:\home\site\wwwroot\node_modules\request\request.js:1157:10)
    at emitOne (events.js:96:13)
    at Request.emit (events.js:188:7)
    at IncomingMessage. (D:\home\site\wwwroot\node_modules\request\request.js:1079:12)
    at IncomingMessage.g (events.js:291:16)
    at emitNone (events.js:91:20)

我们尝试了许多变通方法,但没有任何效果。

node.js azure botframework direct-line-botframework
1个回答
1
投票

看起来你正在尝试使用旧的StateClient,现在已弃用了一段时间。

请遵循有关如何在Bot Framework here for Node.js中保存状态的文档

如果没有关于代码的模式详细信息,我无法提供更多帮助

© www.soinside.com 2019 - 2024. All rights reserved.