本文介绍了无法获得用户的IP地址(代理/防火墙/负载均衡器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用低于code得到与之前asp.net客户端IP,但之后,我搬到VDS这个函数返回开始只有我的子网掩码是178.18.198.1或178.18.198.2。
谁能帮我解决这个问题?

I used code below to get client ip with asp.net before but after I moved to VDS this function begin returning only my subnet mask which is 178.18.198.1 or 178.18.198.2.Can anyone help me with this problem?

Private Function GetIPAddress() As String
    Dim sIPAddress As String = Nothing
    sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")

    If String.IsNullOrEmpty(sIPAddress) Then
        sIPAddress = Request.ServerVariables("REMOTE_ADDR")
    End If

    Return sIPAddress
End Function

修改

找到类似的问题,:

已经部署了2008多的32位
  使用Citrix标准的Web服务器
  NetScaler的ISAPI(在NetScaler的是一个
  负载平衡器),在所有情况下
  客户端IP地址记录在
  标准的IIS日志。在一个新的项目,我
  被要求部署2008 R2,
  配置了IIS 7.5与相同
  我是如何在过去的配置IIS 7.0,
  而这一次的客户端IP
  返回在负载平衡器地址
  日志。这里是怪异的一部分,我
  安装了高级日志,它是
  示出了客户端IP地址
  正确,所以ISAPI是尽
  工作。用Google搜索这一个死亡
  并且可以使用一些建议。

我还发现ISAPI筛选器模块,但不能让它工作:devcentral.f5.com/x_forwarded_for_log_filter_for_windows_servers

I also found ISAPI Filter module but cannot make it work: devcentral.f5.com/x_forwarded_for_log_filter_for_windows_servers

推荐答案

问题在源$ C ​​$ C文件中使用HTTP_CLIENT_IP代替REMOTE_ADDR解决。

Problem solved by using HTTP_CLIENT_IP instead of REMOTE_ADDR in sourcecode files.

有关IIS日志的问题是由安装IIS高级日志模块解决的建议。此外,我得到了错误503:服务不可用。安装高级日志之后,但通过授予读写权限大家的Program Files文件\\ IIS文件夹解决了这个,开始失败的应用程序池

The problem about IIS Logs was solved by installing IIS Advanced Logging module as suggested here. Also I got error "503: Service Unavailable" after installing Advanced Logging but solved this by granting read-write permissions to Everyone for Program Files\IIS folder and started failed application pools.

另一种解决方案建议是:

Another solution suggested here is:

在负载下的NetScaler
  平衡,服务,然后下
  高级选项卡,在设置检查
  对于使用源IP的框,
  客户端IP,然后在头字段
  CLIENT-IP

这篇关于无法获得用户的IP地址(代理/防火墙/负载均衡器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 09:47