【问题标题】:Change azure's pool permissions更改 azure 的池权限
【发布时间】: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


    【解决方案1】:

    当您从 Node.js 应用程序启用标准错误和标准输出的日志记录时,您可以通过 Kudu 查看登录:D:\home\site\wwwroot\iisnode,或通过以下方式浏览:

    https://<yoursitename>.scm.azurewebsites.net/api/vfs/site/wwwroot/iisnode/index.html
    

    【讨论】:

    • 不,那是我的问题。正如我第一次在帖子中所写的那样,该池没有写入日志文件的权限。因此,即使打开了参数,也不会创建任何文件夹。通过输入您的网址,我得到 {"Message":"'D:\\home\\site\\wwwroot\\iisnode\\index.html' not found."}
    • 你能把this post中的web.config文件放到/wwwroot文件夹中吗?
    • 已完成,但仍然存在同样的问题,谢谢。该端口已在默认环境中设置。
    • 您能否编辑您的问题,提供有关您使用的 Node.js 版本和一些示例代码的更多信息?
    • 好的,我会把它加上我的文件夹结构,让你发布
    猜你喜欢
    • 2022-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-01
    • 1970-01-01
    • 2023-03-09
    相关资源
    最近更新 更多