我使用ASP.NET MVC创建了一个门户网站,我需要记录打开该网站的任何客户端的IP地址。我使用NuGet向我的项目添加了NLog,并在Web.config中添加了以下标签:
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="default" xsi:type="File" fileName="logs/app-log.txt" archiveFileName="logs/archives/app-log.{#}.txt" archiveEvery="Day" archiveNumbering="Rolling" maxArchiveFiles="7" />
</targets>
<rules>
<logger name="*" writeTo="default" />
</rules>
</nlog>
如何设置我的应用程序,以记录除注册数据的计算机的IP地址之外的任何其他信息?感谢您的帮助!