NLog在IIS上不起作用

问题描述 投票:2回答:2

我已将NLog添加到我的项目中。按照说明,我创建了NLog.config。

<?xml version="1.0" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <targets>
        <target name="file" xsi:type="File"
            layout="${longdate} ${logger} ${message}" 
            fileName="${basedir}/${shortdate}.log" />
    </targets>

    <rules>
        <logger name="*" minlevel="Debug" writeTo="file" />
    </rules>
</nlog>

然后只记录一些内容。

var logger = LogManager.GetCurrentClassLogger();
logger.Info("xxxx");

使用开发人员Web服务器,它可以正常工作,但是当我将应用程序发布到IIS时,不会创建任何日志。

asp.net-mvc nlog
2个回答
9
投票
NLog.config是否将属性“复制到输出目录”设置为“始终复制”?

0
投票
在IIS中并在“安全性”选项卡下编辑网站权限为IIS_IUSRS组赋予了全部特权。在“应用程序”中,“池”找到您的应用程序正在使用的池,并设置一些特定用户。
© www.soinside.com 2019 - 2024. All rights reserved.