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: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_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);
});
错误日志:
Error: GET to
'http://localhost:54596/v3/botstate/emulator/users/default-user'
failed: [503] Service Unavailable
at Request._callback(/Users/xxx/ADE/BOT/hellobot/node_modules/
botbuilder/lib/bots/ChatConnector.js:559:46)
at Request.self.callback
(/Users/xxx/ADE/BOT/hellobot/node_modules/
request/request.js:186:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/Users/xxx/ADE/BOT/hellobot/node_modules/
request/request.js:1163:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous>
(/Users/xxx/ADE/BOT/hellobot/node_modules/
request/request.js:1085:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
尝试了网址http://localhost:3978/api/messages&amp; http://127.0.0.1:3978/api/messages。知道是什么原因引起了这个问题吗?