繁体   English   中英

global.asax 代码在本地运行良好,但在 IIS 上部署后无法正常运行

[英]global.asax code working fine in local but not after deploying on IIS

我在 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 服务器变量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM