间歇性“远程名称无法解析”? [英] Intermittent 'the remote name could not be resolved'?

查看:624
本文介绍了间歇性“远程名称无法解析”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我使用由的HttpWebRequest 经常阅读网页内容的ASP.NET应用程序。有与远程地址没有问题,我的应用程序始终正常工作。

I have an ASP.NET application that I use to read the contents of a web page by a HttpWebRequest frequently. There's no problem with the remote address and my application is always working fine.

虽然我不改变任何东西,有时(约每天一次)我得到这个错误:

While I don't change anything, sometimes (about once a day) I get this error:

the remote name could not be resolved.

为什么previously解析DNS名称有时无法得到解决?

Why a previously resolved DNS name sometimes fails to be resolved?

推荐答案

这样做的间歇性将是非常难以解决的,它要采取的配置变化,而不是一个code解决方案。 (提示:阅读一切;)

The intermittent nature of this is going to be extremely difficult to resolve and it's going to take a configuration change instead of a code solution. (hint: read everything ;)

我猜想,远程服务器上的DNS设置为常过期pretty。大概每天或者甚至每12小时左右。这是将TTL(生存时间)的设定。如果他们需要到现场迅速转移到新服务器的能力管理员有时将其设置为人为的低水平。

I would guess that the remote servers DNS is set to expire pretty often. Probably daily or maybe even every 12 hours or so. This is the TTL (time to live) setting. Admins sometimes set this to an artificially low level if they need the ability to quickly move the site to a new server.

您可以决定是不是经常用到期去一个命令提示符下运行:

You can determine how often it expires by going to a command prompt and running:

nslookup
set debug
www.theserverdomain.com

在此之上将是说的权威记载:一用一节,上面写着TTL其下一个项目。

At the top of this will be a section that says "AUTHORITY RECORDS:" with an item under it that says "ttl".

现在,(我在这里做一个受过教育的猜测),当您查询您的DNS服务器来解析主机名什么可能发生的事情你的服务器都会有这个值缓存。

Now, (and I'm making an educated guess here), what's probably happening when you query your DNS server to resolve that host name your server will have this value cached.

然而,一旦过期你的服务器将不得不联系其他服务器上游来获得IP地址解析,所谓的DNS转发。如果有很多你和远程服务器之间或者如果站点之间的DNS服务器中的一个超载的话那可能超时并发送回您收到的消息跳。

However, once it expires the your server will have to contact another server upstream to get the ip address resolution, called DNS forwarding. If there are a lot of hops between yours and the remote server OR if one of the DNS servers between the sites is overloaded then it could timeout and send back the message you are receiving.

如果这是真的,那么你可以做的唯一的事情是很难code在Web服务器主机文件的DNS和IP地址的组合。这通常是在 C:\\ WINDOWS \\ SYSTEM32 \\ drivers \\ etc下,是一个名为hosts文件。有关于如何正确在文件中编辑这样一个例子。

If this is true then the ONLY thing you can do is hardcode the DNS and IP address combination in your web servers hosts file. This is usually at C:\Windows\System32\drivers\etc and is a file named "hosts". There is an example on how to properly edit this within the file itself.

一旦创建该文件中的主机映射,Web服务器将不再有联系DNS服务器执行名称解析,它不会不管什么TTL设置为。

Once you create the host mapping in that file, your web server will no longer have to contact the DNS server to perform name resolution and it won't matter what the TTL is set to.

这里唯一的危险是,如果他们移动网站,以一个新的IP地址。在这一点上,你可以简单地更新你的主机文件再次...

The only danger here is if they move the web site to a new IP address. At which point you could simply update your hosts file again...

这篇关于间歇性“远程名称无法解析”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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