Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js http 500测试部署到azure的bot时_Node.js_Azure_Botframework_Skype - Fatal编程技术网

Node.js http 500测试部署到azure的bot时

Node.js http 500测试部署到azure的bot时,node.js,azure,botframework,skype,Node.js,Azure,Botframework,Skype,已将bot从本地git存储库部署到azure- 代码: 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 c

已将bot从本地git存储库部署到azure-

代码:

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);
});
正在以下位置的web聊天中获取http 500错误和消息-

将此消息发送到bot时出错:HTTP状态代码InternalServerError

我可以使用本地主机url、应用程序Id和密码从bot Framework Emulator连接到bot

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

编辑: 将“main”:“index.js”更改为“main”:“app.js”,但仍然无法发送测试消息

EDIT2:我将web.config添加到项目中(对建议的代码没有任何更改),然后在bot页面()上收到消息-由于发生内部服务器错误,无法显示该页面。然后我加了IISnode.yml

loggingEnabled: true
devErrorsEnabled: true
得到这个信息- 将bot推送到azure时记录-

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

我将
“引擎”:{“节点”:“8.1.4”}
添加到package.json并获取

您正在查找的资源已被删除、名称已更改或暂时不可用。 我的机器人-

EDIT3:在制作edit2时,我测试了url并得到了不同的警告

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

然后我在dev.botframework.com和bot框架模拟器上测试bot,在将节点版本添加到包json后,一切都正常。谢谢回复

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

您需要做的是在Node.js应用程序的根目录下创建一个
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>


.

制作edit2时,我测试url并得到不同的警告

无法显示您正在查找的页面,因为正在使用无效的方法(HTTP谓词)。
然后我在dev.botframework.com和bot框架模拟器上测试bot,在将节点版本添加到包json后,一切都正常。谢谢回复

如果您仍有问题,请通过以下网址报告此问题: