如何获得在背后ASP.NET中的负载均衡器的主机名? [英] How to get a host name behind a load balancer in ASP.NET?

查看:114
本文介绍了如何获得在背后ASP.NET中的负载均衡器的主机名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个服务器和负载平衡器。我想说明这是目前提供该页面的服务器名称。

I have a couple of servers and a load balancer. I want to show a server name which is currently serving the page.

我使用 HttpContext.Current.Request.ServerVariables [SERVER_NAME] HttpContext.Current.Request.ServerVariables [LOCAL_ADDR] ,但显示了所有服务器使用相同的数据(负载平衡器信息显示,但不是确切的服务器名称中的信息)。

I am using HttpContext.Current.Request.ServerVariables["SERVER_NAME"] and HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"] but is shows the same data for all servers (load balancer information is shown but not the information about exact server name).

如何获得相关信息?

推荐答案

尝试 System.Environment.MachineName

这篇关于如何获得在背后ASP.NET中的负载均衡器的主机名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆