带防火墙的wcf服务 获取访问者的ip

b87580506 2014-05-06 03:13:32
private string GetUserIpAddress()
{
//提供方法执行的上下文环境
OperationContext context = OperationContext.Current;
//获取传进的消息属性
MessageProperties properties = context.IncomingMessageProperties;
//获取消息发送的远程终结点IP和端口
RemoteEndpointMessageProperty endpoint = properties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;

return endpoint.Address;
}
以上,在内部网络测试时,我可以正常获取访问者的ip;但是正式从外部访问时,因为有防火墙,返回的ip都是防火墙的ip,请教大大这个是怎么回事,有解决方案么
...全文
122 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
b87580506 2014-05-06
  • 打赏
  • 举报
回复
求大大帮助啊

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧