【发布时间】:2017-12-25 01:17:20
【问题描述】:
一切都设置为正常启用日志记录,但由于池的写入权限,任何地方都没有创建 IISnode/ 或 Logging/ 文件夹:
每次我尝试在浏览器中访问我的应用时都会收到此错误消息:
为了查看日志,我必须授权我的应用程序池写入日志文件。
但我不知道在 Azure 门户中的何处编辑权限。
我已经开启了日志记录:
这是我的 IISNode.yml 文件:
node_env: production
loggingEnabled: true
devErrorsEnabled: true
logDirectory: iisnode
debuggingEnabled: true
maxLogFileSizeInKB: 1048
maxLogFiles: 50
那是哪里?
我真的被卡住了,因为没有日志我无法弄清楚为什么我的应用程序无法启动
编辑:
更多细节:
节点版本:7.10.0
项目结构:
gdpr/
web.config
package.json
node_modules/
app/
sslCert.pem
server.js
app.js
config.js
routes.js
knexfile.js
migrations/
api/
controller.js
handlers/
{...several *.js}
起点:server.js
config.js:
var fs = require('fs');
var config = module.exports;
var PRODUCTION = process.env.NODE_ENV === 'production';
config.express = {
port: process.env.EXPRESS_PORT || 51082,
ip: '127.0.0.1'
};
config.knex = require('knex')({
client: 'mysql',
connection: {
host: 'someHost.mysql.database.azure.com',
user: 'someUser@gdprdataserver',
password: 'somePw',
database: 'gdpr',
insecureAuth: true
},
debug: ['ComQueryPacket'],
pool: {
min: 0
}
});
config.migrate = function(cb){
config.knex.migrate.latest()
.then(function() {
cb();
});
}
config.bookshelf = require('bookshelf')(config.knex);
if (PRODUCTION) {
//for example
config.express.ip = '0.0.0.0';
}
server.js:
var app = require('./app');
var config = require('./config');
function launchApp() {
app.listen(config.express.port, config.express.ip, function (err) {
if (err) {
console.log('Unable to listen for connections');
console.log(err);
process.exit(10);
}
console.log('express is listening on http://' + config.express.ip + ':' + config.express.port);
});
}
config.migrate(launchApp);
web.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<webSocket enabled="false" />
<handlers>
<add name="iisnode" path="app/server.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^app/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="app/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>
【问题讨论】:
标签: node.js azure logging pool