我无法登录到我正在部署到Windows Azure的节点应用程序。我使用iisnode.yml文件选项覆盖web.config。
这是yml文件内容:
node_env: development
nodeProcessCountPerApplication: 1
maxConcurrentRequestsPerProcess: 1024
maxNamedPipeConnectionRetry: 24
namedPipeConnectionRetryDelay: 250
maxNamedPipeConnectionPoolSize: 512
maxNamedPipePooledConnectionAge: 30000
asyncCompletionThreadCount: 0
initialRequestBufferSize: 4096
maxRequestBufferSize: 65536
watchedFiles: *.js;iisnode.yml
uncFileChangesPollingInterval: 5000
gracefulShutdownTimeout: 60000
loggingEnabled: true
logDirectory: iisnode
debuggingEnabled: true
debuggerPortRange: 5058-6058
debuggerPathSegment: debug
maxLogFileSizeInKB: 128
maxTotalLogFileSizeInKB: 1024
maxLogFiles: 20
devErrorsEnabled: true
flushResponse: false
enableXFF: false
以下是正在覆盖的web.config文件的内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="false" />
<iisnode configOverrides="iisnode.yml" debuggingEnabled="true" loggingEnabled="true" logDirectory="iisnode" devErrorsEnabled="true" nodeProcessCommandLine=""%programfiles(x86)%\nodejs\node.exe"" />
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<clear />
<rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
<match url="server\.js.+" negate="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="server.js" />
</rule>
<rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
<match url="iisnode"/>
</rule>
<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>
</system.webServer>
</configuration>
我很确定我已经启用了两者中的每个日志记录选项,但在部署期间以及当我访问典型的日志记录位置http://mysite.com/iisnode/index.html或http://mysite.com/iisnode/时,Azure似乎都没有选择我收到404错误。
任何帮助或想法都将不胜感激。
答案 0 :(得分:4)
如果您使用快速,请在静态文件夹位置添加
app.use(express.static(__dirname + '/../iisnode'));
或者定义你自己的日志路线,如下所示..在这里你可以得到花哨,只显示错误等。
//logging routes
var fs = require('fs');
app.get('/iisnode', function(req, res){
var _index = fs.readFileSync('./iisnode/index.html', 'utf8');
var index = _index.replace("logCell.innerHTML = '<a href=\"' + logFile.file + '\">log</a>';", "logCell.innerHTML = '<a href=\"/iisnode/' + logFile.file + '\">log</a>';");
res.send(index);
});
app.get('/iisnode/:log', function(req, res){
var _log = fs.readFileSync('./iisnode/' + req.route.params['log'], 'utf8');
res.contentType('text/plain');
res.send(_log);
});
您可以将app.get替换为您正在使用的路由解决方案。
在生产中启动应用之前,请务必先删除。