我在global.asax中有以下代码。我在本地获取remote_addr详细信息,但在部署后没有。
log4net.GlobalContext.Properties["username"]=System.Net.Dns.GetHostEntry(Request.ServerVariables["remote_addr"](.HostName.ToString((;
要获取主机名,需要打开反向dns查找。这是IIS中的行为变化。system.webServer/security/ipSecurity@doReverseDns并获取REMOTE_ HOST服务器变量。