开发者

How to get a host name behind a load balancer in 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.

I am using H开发者_运维百科ttpContext.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).

How to get a relevant information?


Try System.Environment.MachineName.


Perhaps Server.MachineName does what you are looking for?


Page.Request.ServerVariables["HTTP_HOST"].ToUpper();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜