|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
.Net 2.0 & Dns.GetHostEntryI am intermitently getting a System.Net.Sockets.SocketException ("No such
host is known") when calling Dns.GetHostEntry(). It doesn't seem to have any pattern to it, but seems to be occurring on a variety of IP addresses (e.g. internal addresses such as 192.168.x.x). Anyone else see this? Is there a known .Net 2.0 bug for this? Joe So I verified this fails any time there is a DNS configuration that results
in nslookup returning an error regarding "Non-existent domain." In my case this is a system that is not part of a domain but is performing an nslookup on a system that is in a domain. Oddly enough, the deprecated method Dns.GetHostEntry replaces, Dns.GetByName, works flawlessly. Below you will find the sample code to reproduce and the nslookup results. It seems this is a .Net 2.0 bug. ******nslookup results****** nslookup -type=ptr 192.168.100.10 Server: my-dc.mycompany.int Address: 192.168.100.10 *** my-dc.mycompany.int can't find 192.168.100.10: Non-existent domain ******Sample Code****** using System; using System.Collections.Generic; using System.Text; using System.Net; namespace TestDns { class Program { static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("TestDns [ip address or hostname]"); return; } Console.WriteLine("Test #1"); try { Console.WriteLine(Dns.GetHostEntry(args[0]).HostName); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } Console.WriteLine("Test #2"); try { Console.WriteLine(Dns.GetHostByName(args[0]).HostName); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); } } } } On Wed, 04 Apr 2007 13:08:20 -0700, Joe K <joe@nospamplease.com> wrote:
> So I verified this fails any time there is a DNS configuration that I don't know what the problem is, but one person wrote a comment to this > results in nslookup returning an error regarding "Non-existent > domain." In my case this is a system that is not part of a domain > but is performing an nslookup on a system that is in a domain. > Oddly enough, the deprecated method Dns.GetHostEntry replaces, > Dns.GetByName, works flawlessly. Below you will find the sample > code to reproduce and the nslookup results. > > It seems this is a .Net 2.0 bug. documentation page: http://msdn2.microsoft.com/en-us/library/ms143998.aspx ....that seems to confirm the problem you're having (though in a slightly different example, the behavior seems basically the same problem). I wonder if you or the other person has reported this problem as a bug yet. I haven't run into it myself, but if you have a reproducible example, you should probably report it so that it can be fixed. Pete Yes, I think I have a reproducible case but it requires a specific DNS
setup. The link you pointed me to sounds exactly like my issue, but I think the poster didn't realize there is a more specific setup required to reproduce (e.g. I can run his test case without a problem). I wasn't planning on reporting it as a bug due to the sheer effort to push this through Microsoft (e.g. open a case, wait a week for callback, work through 1st level engineer, wait for engineer to setup & reproduce, wait for engineer to talk with development, wait for development to acknowledge as a bug, etc.., etc...). Okay, okay, I am a bit jaded by my last two experiences in which after all that effort, the product failures we actually deemed documentation bugs! If anyone has more details, I'd be interested. In the meantime, I will be making a critical hotfix to our application that uses the deprecated method instead of GetHostEntry. Thanks for reply. Joe |
|||||||||||||||||||||||