我有基本的快递4应用程序运行在本地使用节点提供的web服务器。
我试图查看/编辑view矩阵并使用IIS,这样我就可以将其作为一个节点应用程序上传到Azure。Azure的模板使用了较早版本的节点和表达式。
当使用IIS从When矩阵运行时,当发布到Azure时,我会收到以下信息:
HRESULT: 0x2
HTTP status: 500
HTTP reason: Internal Server Error
我相信这个问题在某种程度上与web.config文件有关,但是我发现的所有文章和修复都是过时的,而且还没有解决这个问题。
我的web.config文件:
<configuration>
<system.webServer>
<handlers>
<!-- indicates that the app.js file is a node.js application to be handled by the iisnode module -->
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<!-- Don't interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^app.js\/debug[\/]?" />
</rule>
<!-- 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 application entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
</conditions>
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
<!-- You can control how Node is hosted within IIS using the following options -->
<!--
<iisnode
node_env="%node_env%"
nodeProcessCountPerApplication="1"
maxConcurrentRequestsPerProcess="1024"
maxNamedPipeConnectionRetry="3"
namedPipeConnectionRetryDelay="2000"
maxNamedPipeConnectionPoolSize="512"
maxNamedPipePooledConnectionAge="30000"
asyncCompletionThreadCount="0"
initialRequestBufferSize="4096"
maxRequestBufferSize="65536"
watchedFiles="*.js"
uncFileChangesPollingInterval="5000"
gracefulShutdownTimeout="60000"
loggingEnabled="true"
logDirectoryNameSuffix="logs"
debuggingEnabled="true"
debuggerPortRange="5058-6058"
debuggerPathSegment="debug"
maxLogFileSizeInKB="128"
appendToExistingLog="false"
logFileFlushInterval="5000"
devErrorsEnabled="true"
flushResponse="false"
enableXFF="false"
promoteServerVars=""
/>
-->
</system.webServer>
</configuration>
我已经联系了Azure团队,他们已经开始了一场讨论,但我对堆叠溢出用户可以提供什么更有信心。
发布于 2016-02-05 00:16:37
@Matthew,
下面是我的猜测,我认为在部署到azure应用程序服务时,您没有配置您的应用程序来监听正确的端口。您需要执行类似于以下代码的操作,才能从环境验证的"process.env.port“中获得端口号。
var app = require('express')();
var port = process.env.port || 8080; // 8080 for local or whatever number u want
var listener = app.listen(port, function(){
console.log('Listening on port ' + port);
});
https://stackoverflow.com/questions/35206327
复制相似问题