Log4Net - 用于 Windows 负载平衡的日志服务器 IP
Posted
技术标签:
【中文标题】Log4Net - 用于 Windows 负载平衡的日志服务器 IP【英文标题】:Log4Net - Logging Server IP for Windows Load Balancing 【发布时间】:2012-10-02 05:27:55 【问题描述】:我们目前正在使用硬件负载平衡并将切换到软件 (Windows Server 2008)。在测试运行中,使用软件负载均衡的服务器向 Log4Net 报告的是负载均衡 IP,而不是服务器 IP。
这就是我们在 Log4Net 中设置服务器 IP 的方式:
HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]
为了记录服务器 IP 而不是负载平衡器 IP,我需要将其更改为什么?
谢谢!!!
【问题讨论】:
【参考方案1】:看看这篇文章。 How to get the IP address of the server on which my C# application is running on?
并不像人们想象的那么简单,因为一台服务器可以有多个 IP 地址。
【讨论】:
以上是关于Log4Net - 用于 Windows 负载平衡的日志服务器 IP的主要内容,如果未能解决你的问题,请参考以下文章
Windows Server 2008 R2 负载平衡入门篇
使用 Windows 服务器对 PostgreSQL 进行负载平衡