来自IISnode的随机HTTP 5xx错误

时间:2018-01-25 07:55:39

标签: node.js azure iis botframework

我正在使用NODEjs SDK处理Botbuilder框架,我有直接对话的当前设置

  • 一个nodejs web UI,它是bot的聊天界面
  • nodejs bot logic server

这两台服务器都托管在一个带有IIS节点网络服务器的Azure应用程序(Windows Server 2016)中

目前,包含机器人逻辑的服务器具有以下路由(使用restify框架)

   server.post('/receiveMessage', connector.listen());

    server.post('/beginSpecialDialog', function(req,res,next){
        var _body = req.body;
        logger("info", "server", "/beginSpecialDialog triggered", null, {"conversationId": _body._directlineAddress.conversation.id})
        if(_body._directlineAddress.secret !== config.BOT.DIRECTLINE_SECRET){
            logger("warn", "server", "directline credentials do not match", null, {"conversationId": _body._directlineAddress.conversation.id, "secretSent":_body._directlineAddress.secret, "err":err});                            
            res.send(401);
        }
        bot.beginDialog(_body._directlineAddress, _body._dialogId, _body._specialParams, function(err){
            if(err){
                logger("warn", "server", "error occured on starting main dialog from url", null, {"conversationId": _body._directlineAddress.conversation.id, "err":err});
                res.send(400, {"err": err.stack });
            }
            else{
                res.send(200);
            }
        });
    });

只要我们需要传送机器人来为webUI浏览器启动一个特殊的Dialog,webUI服务器就会发起/beginSpecialDialog

然而,有时候(每10个请求中有1个左右) - 这个路由不会被僵尸服务器处理。我从机器人服务器获得了5xx响应,其中包含以下详细信息

</head>
<body>
<div id="content">
<div class="content-container">
<h3>HTTP Error 500.1013 - Internal Server Error</h3>
<h4>The page cannot be displayed because an internal server error has occurred.</h4>
</div>
<div class="content-container">
<fieldset><h4>Most likely causes:</h4>
<ul>    <li>IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.</li>    <li>IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.</li>    <li>IIS was not able to process configuration for the Web site or application.</li>     <li>The authenticated user does not have permission to use this DLL.</li>       <li>The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.</li> </ul>
</fieldset>
</div>
<div class="content-container">
<fieldset><h4>Things you can try:</h4>
<ul>    <li>Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.</li>     <li>Check the event logs to see if any additional information was logged.</li>  <li>Verify the permissions for the DLL.</li>    <li>Install the .NET Extensibility feature if the request is mapped to a managed handler.</li>  <li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul>
</fieldset>
</div>

<div class="content-container">
<fieldset><h4>Detailed Error Information:</h4>
<div id="details-left">
<table border="0" cellpadding="0" cellspacing="0">
<tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;iisnode</td></tr>
<tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr>
<tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;iisnode</td></tr>
<tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x0000006d</td></tr>

</table>
</div>
<div id="details-right">
<table border="0" cellpadding="0" cellspacing="0">
<tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;https://test-bot-website:80/server.js</td></tr>
<tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;D:\home\site\wwwroot\server.js</td></tr>
<tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr>
<tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr>

</table>
<div class="clear"></div>
</div>
</fieldset>
</div>

<div class="content-container">
<fieldset><h4>More Information:</h4>
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
<p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=500,1013,0x0000006d,14393">View more information &raquo;</a></p>
<p>Microsoft Knowledge Base Articles:</p>


</fieldset>
</div>
</div>
</body>
</html>

来自IIS节点webserver的日志

2018-01-25 06:22:58 TEST-BOT-WEBSITE POST /beginSpecialDialog X-ARR-LOG-ID=da648f30-dda9-4103-8a48-862b65eef82d 443 - 23.102.157.162 - - - test-bot-website.azurewebsites.net 500 1013 109 298 1425 120540

有人能说清楚为什么会这样吗?继承我的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 site to be handled by the iisnode module -->
      <add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
    </handlers>
    <rewrite>
      <rules>

        <!-- BEGIN rule TAG FOR WWW and HTTP to HTTPS REDIRECT -->
        <rule name="First_Secure" stopProcessing="true">
            <match url=".*" />
            <conditions>
                <add input="{HTTPS}" pattern="OFF" />
            </conditions>
            <action type="Redirect" url="https://{HTTP_HOST}" />
        </rule>
        <rule name="Second_Redirect" stopProcessing="true">
            <match url=".*" />
            <conditions>
                <add input="{HTTPS}" pattern="ON" />
                <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" ignoreCase="false" />
            </conditions>
            <action type="Redirect" url="https://{C:2}" />
        </rule>
        <!-- END rule TAG FOR WWW and HTTP to HTTPS REDIRECT -->

        <!-- Do not interfere with requests for node-inspector debugging -->
        <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
          <match url="^server.js\/debug[\/]?" />
        </rule>

        <!--This redirects home page to /public/index.html-->
        <rule name="DefaultDocRewrite" stopProcessing="True">
          <match url="^$" />
          <action type="Rewrite" url="/public/index.html" />
        </rule>

         <!--This redirects all urls to public -->
        <rule name="StaticContentRewrite">
          <action type="Rewrite" url="public{REQUEST_URI}"/>
        </rule>
         <!--This catches if the file exists under public directory and stops processing, so that iis will serve static files -->
        <rule name="StaticContent" stopProcessing="True">
           <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" />
            <add input="{REQUEST_URI}" pattern="^/public/" />
           </conditions>
        </rule>

        <!-- All other URLs are mapped to the node.js site entry point -->
        <rule name="DynamicContent">
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
          </conditions>
          <action type="Rewrite" url="server.js"/>
        </rule>
      </rules>
    </rewrite>

    <!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin"/>
        </hiddenSegments>
      </requestFiltering>
    </security>

    <!-- Make sure error responses are left untouched -->
    <httpErrors existingResponse="PassThrough" />

    <!--
      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
    -->
    <!-- Runs node processes on each core you have in the machine -->
    <iisnode watchedFiles="web.config" nodeProcessCountPerApplication="0"/> 
  </system.webServer>
</configuration>

0 个答案:

没有答案