Sto cercando di distribuire un'applicazione node.js su IIS 7.0 ospitato su un computer Windows 2008 utilizzando il modulo IISNode. Ho il seguente file web.config -
<configuration>
<system.webServer>
<webSocket enabled="false" />
<handlers>
<add name="iisnode" path="build/index.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="^build/server.js/debug[/]?" />
</rule>
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</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="build/index.js"/>
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" /></system.webServer></configuration>
Quando navigo nel sito, fornisce un HTTPErrore interno del server errore 500.19 che si è lamentato del web.config non valido. Questa configurazione esatta funziona sull'app azure wep senza alcun problema. Ho anche installato il modulo Rewrite.
Se qualcuno si è imbattuto in questo problema e qualsiasi aiuto sarebbe molto apprezzato.
Grazie molto.
MODIFICATO - Il problema era con la seguente riga -
<webSocket enabled="false" />
La rimozione ha risolto il problema. Ma ho avuto un errore nel tentativo di accedere al sito -
iisnode non è stato in grado di stabilire una named pipe connection con il processo node.exe prima che il processo terminasse
risposte:
0 per risposta № 1che ne dici di questo web.config?
<configuration>
<rewrite>
<rules>
<!-- 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 site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="build/index.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
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</configuration>
0 per risposta № 2
Fondamentalmente l'ultimo problema era un problema di autorizzazioni nel mio caso: dovevo dare il pieno controllo al gruppo IIS_Users alla cartella dell'app nodo e funzionava per me.
Grazie.