testingbot部署到azure色时,HTTP 500

从本地git存储库部署bot到Azure – https://docs.microsoft.com/en-us/bot-framework/deploy-bot-local-git

代码:

var restify = require('restify'); var builder = require('botbuilder'); var server = restify.createServer(); server.listen(process.env.port || process.env.PORT || 3978, function () { }); // Create the chat connector for communicating with the Bot Framework Service var connector = new builder.ChatConnector({ appId: "app-id", appPassword: "app-password" }); // Listen for messages from users server.post('/api/messages', connector.listen()); // Create your bot with a function to receive messages from the user var bot = new builder.UniversalBot(connector, function (session) { // echo the user's message session.send("You said: %s", session.message.text); }); 

通过https://dev.botframework.com在Web聊天中获取http 500 errror和消息 –

发送此消息到您的机器人发生错误:HTTP状态代码InternalServerError

我可以通过本地主机URL和应用程序ID和密码从Bot Framework模拟器连接到机器人。

也许我需要指定的Web应用程序是nodejs? 我没有在应用程序设置中看到有关app或nodejs选项的入口点的任何信息。

编辑:改变“主”:“index.js”为“主”:“app.js”,但仍不能发送testing消息。

编辑2:我添加web.config项目(没有任何改变build议的代码),之后,我得到消息在僵尸网页( http://it-perf-bot.azurewebsites.net/api/messages ) – 页面不能由于发生内部服务器错误而显示。 然后我添加IISnode.yml

 loggingEnabled: true devErrorsEnabled: true 

并得到这个消息 – http://prntscr.com/gc8vww日志时推bot到天青 – http://prntscr.com/gc8wia ,

package.json文件不指定node.js引擎版本约束。

我添加"engines":{"node": "8.1.4"} package.json并得到

您正在查找的资源已被删除,名称已更改,或暂时不可用。 我的机器人 – https://github.com/lavandil/skypeBot1 。

编辑3:编辑2时,我testing了urlhttp://it-perf-bot.azurewebsites.net/api/messages并获得不同的警告

您正在查找的页面无法显示,因为正在使用无效的方法(HTTP动词)。

然后,我在dev.botframework.com和Bot Framework Emulator上testingbot – 在将json节点版本添加到包之后,所有工作都在进行。 感谢您的回复!

也许我需要指定的Web应用程序是nodejs? 我没有在应用程序设置中看到有关app或nodejs选项的入口点的任何信息。

你需要做的是在你的Node.js应用程序的根目录下创build一个web.config文件,如果不存在的话。 作为参考,以下是使用app.js作为入口点的应用程序的默认web.config

 <?xml version="1.0" encoding="UTF-8"?> <!-- This configuration file is required if iisnode is used to run node processes behind IIS or IIS Express. For more information, visit: https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config --> <configuration> <system.webServer> <!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support --> <webSocket enabled="false" /> <handlers> <!-- Indicates that the server.js file is a node.js web app to be handled by the iisnode module --> <add name="iisnode" path="app.js" verb="*" modules="iisnode" /> </handlers> <rewrite> <rules> <!-- Do not interfere with requests for node-inspector debugging --> <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^app.js\/debug[\/]?" /> </rule> <!-- First we consider whether the incoming URL matches a physical file in the /public folder --> <rule name="StaticContent"> <action type="Rewrite" url="public{REQUEST_URI}" /> </rule> <!-- All other URLs are mapped to the node.js web app entry point --> <rule name="DynamicContent"> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /> </conditions> <action type="Rewrite" url="app.js" /> </rule> </rules> </rewrite> <!-- You can control how Node is hosted within IIS using the following options: * watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server * node_env: will be propagated to node as NODE_ENV environment variable * debuggingEnabled - controls whether the built-in debugger is enabled See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options --> <!--<iisnode watchedFiles="web.config;*.js"/>--> </system.webServer> </configuration> 

另外,如果出现500错误,则需要启用stdout和stderr的日志logging,以查看日志所说的内容。 要启用debugging,请参阅我在此之前的答案 。

在编辑edit2的同时,我testingurlhttp://it-perf-bot.azurewebsites.net/api/messages并得到不同的警告

您正在查找的页面无法显示,因为正在使用无效的方法(HTTP动词)。 然后,我在dev.botframework.com和Bot Framework Emulator上testingbot – 在将json节点版本添加到包之后,所有工作都在进行。 感谢您的回复!