asp.net SERVER_NAME返回错误的域名 [英] asp.net SERVER_NAME returns wrong domain name
问题描述
有人可以向我解释asp.net/iis如何获取SERVER_NAME变量吗?
当我们更改生产域名时,会出现问题.后端代码通过调用以下方法Request.ServerVariables["SERVER_NAME"]
返回旧值.
可能与DNS更新有关吗?
Can anyone explain me how the asp.net/iis gets SERVER_NAME variable ?
The problem appears when we change our production domain name. The backend code returns old value by calling the following method Request.ServerVariables["SERVER_NAME"]
.
Could it be related to DNS update ?
推荐答案
后端代码通过调用以下方法Request.ServerVariables ["SERVER_NAME"]
The backend code returns old value by calling the following method Request.ServerVariables["SERVER_NAME"]
通常此可变收益
服务器的主机名,DNS别名或IP地址,就像在自引用URL中显示的一样.
The server's host name, DNS alias, or IP address as it would appear in self-referencing URLs.
检查
- DNS更改已传播到此服务器.在服务器本身上进行反向DNS查找.如果是这种情况,请刷新本地DNS缓存(
ipconfig /flushdns
) - 确保DNS PTR记录已正确更新
- 主机名未设置为与旧的DNS名称匹配
这篇关于asp.net SERVER_NAME返回错误的域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!