2017-07-19 141 views
0

我跑我的Node.js应用程序要求,我得到了一个沉重的错误权限与iisnode

iisnode encountered an error when processing the request. 

HRESULT: 0x2 
HTTP status: 500 
HTTP subStatus: 1002 
HTTP reason: Internal Server Error 
You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'. 

In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem. 

The node.exe process has not written any information to stderr or iisnode was unable to capture this information. Frequent reason is that the iisnode module is unable to create a log file to capture stdout and stderr output from node.exe. Please check that the identity of the IIS application pool running the node.js application has read and write access permissions to the directory on the server where the node.js application is located. Alternatively you can disable logging by setting system.webServer/iisnode/@loggingEnabled element of web.config to 'false'. 

有人说,错误是env.Port别人说是从webconfig,我需要设置为服务器.js,我已经设置了它,即使我删除它,我也得到了相同的错误。

我与IIS客户端试图设置权限 enter image description here

在第3天,我想不出我做错了什么,我试图与不web.cofig。 我错过了什么吗? 此外,通过Azure门户提供的字符串设置到MongoDB的连接。

回答

0

我能够重现完全相同的错误。

enter image description here

这里是我的server.js

const express = require('express') 
const app = express() 

app.get('/', function (req, res) { 
    res.send('Hello World!') 
}) 

app.listen(3000) 

web.config,我有这样的:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <system.webServer>   
     <webSocket enabled="false" /> 

     <handlers> 
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" /> 
     </handlers> 

     <rewrite> 
      <rules> 
       <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true"> 
        <match url="^server.js\/debug[\/]?" /> 
       </rule> 
       <rule name="StaticContent"> 
        <action type="Rewrite" url="public{REQUEST_URI}" /> 
       </rule> 
       <rule name="DynamicContent"> 
        <conditions> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" /> 
        </conditions> 
        <action type="Rewrite" url="server.js" /> 
       </rule> 
      </rules> 
     </rewrite> 

     <security> 
      <requestFiltering> 
       <hiddenSegments> 
        <remove segment="bin" /> 
       </hiddenSegments> 
      </requestFiltering> 
     </security> 

     <httpErrors existingResponse="PassThrough" /> 

     <iisnode 
      watchedFiles="web.config;*.js" 
      node_env="%node_env%" 
      loggingEnabled="true" 
      logDirectory="iisnode" 
      debuggingEnabled="true" 
      maxLogFileSizeInKB="1048" 
      maxLogFiles="50" 
      devErrorsEnabled="true" /> 
    </system.webServer> 
</configuration> 

利用这些配置,我可以访问https://{mysitename}.scm.azurewebsites.net/api/vfs/site/wwwroot/iisnode/index.html看到详细的错误。

enter image description here

改变app.listen(3000)app.listen(process.env.PORT || 3000)后,我得到它的工作。

enter image description here

更多内容:

Nodejs application returns error: iisnode encountered an error when processing the request HRESULT: 0x2 HTTP status: 500 HTTP subStatus: 1002

+0

后尝试此5天,我也试过这个解决方案,并且不工作对我来说,我试图做的MongoDB教程我得到后,混帐推'g failed' –