Eu corro meu aplicativo Node.js e recebo um erro pesado
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".
Alguns dizem que o erro é de env.Port outros dizem que é de webconfig que preciso definir para server.js, eu já defini, mesmo se eu excluir eu tenho os mesmos erros.
Eu tentei com o cliente iis para definir permissões
Em 3 dias eu não consigo descobrir o que eu fiz de errado, eu tentei com e sem web.cofig. Estou esquecendo de algo ? Além disso, a conexão com o MongoDB é definida com a string fornecida pelo portal do Azure.
Respostas:
0 para resposta № 1Eu sou capaz de reproduzir exatamente o mesmo erro.
Aqui está o meu server.js
:
const express = require("express")
const app = express()
app.get("/", function (req, res) {
res.send("Hello World!")
})
app.listen(3000)
Dentro web.config
, Eu tenho isto:
<?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>
Com essas configurações, posso visitar https://{mysitename}.scm.azurewebsites.net/api/vfs/site/wwwroot/iisnode/index.html
para ver o erro detalhado.
Depois de mudar app.listen(3000)
para app.listen(process.env.PORT || 3000)
Eu tenho que trabalhar.
Mais sobre isso: