asp.net – ServerVariables [“HTTP_HOST”]和ServerVariables [“SERVER_NAME”]之间有什么区别?

前端之家收集整理的这篇文章主要介绍了asp.net – ServerVariables [“HTTP_HOST”]和ServerVariables [“SERVER_NAME”]之间有什么区别?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我对这两个服务器变量的区别感到困惑.检查IIS文档,它说: @H_403_2@HTTP_HOST

@H_403_2@Returns the name of the Web server.
This may or may not be the same as
SERVER_NAME depending on type of name
resolution you are using on your Web
server (IP address,host header).

@H_403_2@服务器名称

@H_403_2@The server’s host name,DNS alias,or
IP address as it would appear in
self-referencing URLs.

@H_403_2@有人可以提供一些例子,如何可以不同?

@H_403_2@我们在我们的网络农场中有2个IIS Web服务器,每个都有2个网站(当然,每个服务器相同).

@H_403_2@对于每个网站都有约5个左右的绑定.

@H_403_2@那么价值观是什么?有什么不同?

解决方法

刚刚发现,在IIS托管的aspx页面之一中启用跟踪,SERVER_NAME只返回服务器名称,而HTTP_HOST返回站点运行的servername:port.启用跟踪集 @H_403_2@<%@ Page Language =“C#”AutoEventWireup =“true”CodeBehind =“WebForm1.aspx.cs”Inherits =“WebApplication3.WebForm1”Trace =“true”%>

@H_403_2@注意跟踪值

猜你在找的asp.Net相关文章