System.Net.Dns.GetHostAddresses地址错误... [英] Wrong address with System.Net.Dns.GetHostAddresses...

查看:62
本文介绍了System.Net.Dns.GetHostAddresses地址错误...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试获取dyndns服务器的IP地址.
我尝试了几种方法.
手动执行"ping myserver.dnsalias.net"即可正常运行
通过C#

I try to get the IP address of a dyndns server.
I have tried several methodes.
Doing it by hand with a "ping myserver.dnsalias.net" works fine
By C#

System.Net.Dns.GetHostAddresses("myserver.dnsalias.net")




or

Dns.GetHostEntry("myserver.dnsalis.net");




or

pingSender.Send("myserver.dnsalis.net" );



总是返回错误或旧地址.
你知道该怎么办吗?

问候
Peter



always returns a wrong or maybe old address.
Any idea what to do ?

regards
Peter

推荐答案

谢谢,但这是我尝试过的选择之一.
返回的所有IP地址(至少两个)都是错误的.我尝试过的其他两个功能相同:

Dns.GetHostEntry("myserver.dnsalis.net");



pingSender.Send("myserver.dnsalis.net");

所有方法都会导致相同的IP地址错误.
同一台计算机在同一网络上,使用命令行"ping"进行测试.

我试图通过wireshark看到c#程序的DNS请求,但是我没有找到它.通过命令行"ping"进行测试,我可以看到Wireshark的DNS请求.也许我可以使用.net LIB的配置来缓存IP地址或禁用缓存?
Thank you, but this is one of the option that I have tried.
All IP adresses which are returned (at least two) are wrong. Same for the other two functions I have tried :

Dns.GetHostEntry("myserver.dnsalis.net");

and

pingSender.Send("myserver.dnsalis.net" );

All methodes lead to the same wrong IP adress.
Same computer same network the test with command line "ping" works.

I have tried to see the DNS request of the c# program by wireshark, but I didn''t found it. Doing the test by command line "ping" I can see the DNS request with wireshark. Maybe there is a configuration I can use for the .net LIB to cache the IP address or to disable a cache ?


这篇关于System.Net.Dns.GetHostAddresses地址错误...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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