2016-11-17 57 views
1

當我將bot代碼推向天藍色時,它是成功的。我測試Microsoft Bot Framework錯誤 - InternalServerError {「Message」:「發生錯誤。」 }

我更新了我的web.config文件中使用正確的憑據推動它使用節點app.js天青之前它的工作

var builder = require('botbuilder'); 

var connector = new builder.ConsoleConnector().listen(); 
var bot = new builder.UniversalBot(connector); 
bot.dialog('/', [ 
    function (session) { 
     builder.Prompts.text(session, 'Hi! What is your name?'); 
    }, 
    function (session, results) { 
     session.send('Hello %s!', results.response); 
    } 
]); 

當我看着蔚藍的日誌我得到以下信息

2016-11-17T13:31:12.880 Executing: 'Functions.messages' - Reason: 'This function was programmatically called via the host APIs.' 
2016-11-17T13:31:12.880 Function started (Id=22f4fffb-ad0d-4b54-b86f-dd895c098910) 
2016-11-17T13:31:12.880 Function completed (Failure, Id=22f4fffb-ad0d-4b54-b86f-dd895c098910) 
2016-11-17T13:31:12.880 A ScriptHost error has occurred 
2016-11-17T13:31:12.880 Error: Implement me. Unknown stdin file type! 
    at process.getStdin [as stdin] (internal/process/stdio.js:82:15) 
    at ConsoleConnector.listen (D:\home\site\wwwroot\messages\node_modules\botbuilder\lib\bots\ConsoleConnector.js:11:60) 
    at Object.<anonymous> (D:\home\site\wwwroot\messages\index.js:3:48) 
    at Module._compile (module.js:556:32) 
    at Object.Module._extensions..js (module.js:565:10) 
    at Module.load (module.js:473:32) 
    at tryModuleLoad (module.js:432:12) 
    at Function.Module._load (module.js:424:3) 
    at Module.require (module.js:483:17) 
    at require (internal/module.js:20:19) 
2016-11-17T13:31:12.880 Function started (Id=22f4fffb-ad0d-4b54-b86f-dd895c098910) 
2016-11-17T13:31:12.880 Function completed (Failure, Id=22f4fffb-ad0d-4b54-b86f-dd895c098910) 
2016-11-17T13:31:12.895 Exception while executing function: Functions.messages. mscorlib: Error: Implement me. Unknown stdin file type! 
    at process.getStdin [as stdin] (internal/process/stdio.js:82:15) 
    at ConsoleConnector.listen (D:\home\site\wwwroot\messages\node_modules\botbuilder\lib\bots\ConsoleConnector.js:11:60) 
    at Object.<anonymous> (D:\home\site\wwwroot\messages\index.js:3:48) 
    at Module._compile (module.js:556:32) 
    at Object.Module._extensions..js (module.js:565:10) 
    at Module.load (module.js:473:32) 
    at tryModuleLoad (module.js:432:12) 
    at Function.Module._load (module.js:424:3) 
    at Module.require (module.js:483:17) 
    at require (internal/module.js:20:19). 

我不知道這是什麼或如何發生。

任何幫助,將不勝感激,

感謝

回答

1

我順利地通過以下步驟部署Microsoft博特框架天青應用服務。你可以試試嗎?

1.一旦你註冊了你的機器人,在Azure門戶中設置必要的環境變量。

enter image description here

2.註冊使用NPM的Bot BuilderRestify模塊。

npm install --save botbuilder 
npm install --save restify 

3.Make一個名爲app.js文件,並在幾行代碼打招呼。

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 bot 
var connector = new builder.ChatConnector({ 
    appId: process.env.MICROSOFT_APP_ID, 
    appPassword: process.env.MICROSOFT_APP_PASSWORD 
}); 
var bot = new builder.UniversalBot(connector); 
server.post('/api/messages', connector.listen()); 

bot.dialog('/', function (session) { 
    session.send("Hello World"); 
}); 

4.轉到Microsoft Bot Framework門戶並編輯您的機器人詳細信息。使用從Azure部署中生成的端點,並且不要忘記,在使用Bot應用程序模板時,您需要將您粘貼的URL擴展到端點的路徑/api/messages。您還應該使用HTTPS而不是HTTP前綴URL。 enter image description here 5.一旦您完成了這裏的步驟,您可以測試並驗證Bot框架可以與您的Bot的Web服務進行通信。

enter image description here

希望這有助於。

+0

謝謝我今天晚些時候會嘗試這個,並回復 – user1907509

+0

我已經按照你的步驟,我得到了未經授權。我檢查了應用程序設置並生成了MICROSOFT_APP_ID和MICROSOFT_PASSWORD_ID。我仍然收到這條消息。有什麼想法嗎? – user1907509

+0

你在'web.config'中刪除了appid和密碼嗎? –