Closed NXTwoThou closed 2 years ago
That's not a DNS error, you get a timeout exception which is a hard error. DNS error would be something the DNS server returns, e.g. the requested domain doesn't exist etc.
You also set the Timeout to one second which is really short so its pretty likely to get random timeout errors if the server you use isn't that quick...
var dns = new DnsClient.LookupClient(); dns.Timeout = TimeSpan.FromSeconds(1); dns.ThrowDnsErrors = false; var iphostentry=dns.GetHostEntry("1.53.15.30");
Throws Query 15680 => 30.15.53.1.in-addr.arpa. IN PTR on 10.10.10.51:53 timed out or is a transient error.
I was going through trying to fill in hostnames in our security ip blocking software and it kept throwing errors. I went through 60 until I hit this particular ip and found that every time I call this one particular ip, it throws an exception even though ThrowDnsErrors is false.
I thought it was totally random, but it'll throw an error every single time certain ips are checked. Out of my first test batch of 255 ips, 12 of them threw errors. I can provide a list if desired. I just figured when ThrowDnsErrors is set to false, GetHostEntry would return null, not throw an error.