2017-07-19 197 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' –