473,587 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.Net.Dns. Resolve issue

Hi All,

This is a cut down version of a post from earlier entitled "Name resolution
in .Net". Apologies, for the repeat, but I think the first post was too
verbose (it came from a blog article of mine) and I think a shorter post
here is probably more appropriate.

I am seeing some incorrect behaviour on System.Net.Dns. Resolve( hostname )
It would appear that this does more than just a DNS lookup (which is what it
says in the documentation), at least when resolving the address of the
local machine.

I have a server with two NICs and hence two IP addresses: 10.0.0.5 and
192.168.0.2. Only the latter of these has a DNS entry (mapping to the host
name 'terminus'). The former IP address is not listed anywhere (DNS or hosts
file).
If I call System.Net.Dns. Resolve( 'terminus') from the server itself, I get
both IP addresses coming back. How is this possible if the call is only
doing a DNS lookup? A test with nslookup verifies that the name 'terminus'
has a single A record only, pointing to 192.168.0.2.

My suspision is that this call is also checking the NetBIOS name cache;
"netstat -a terminus" lists the same results as the resolve call. If so,
this is not what the documentation says it does.

Any ideas anyone ?
Is it possible to do a DNS lookup ONLY on a hostname ?

Thanks in advance for any help,

Rob Levine
http://roblevine.blogspot.com
Nov 16 '05 #1
2 6129
Rob Levine wrote:
Hi All,

This is a cut down version of a post from earlier entitled "Name resolution
in .Net". Apologies, for the repeat, but I think the first post was too
verbose (it came from a blog article of mine) and I think a shorter post
here is probably more appropriate.

I am seeing some incorrect behaviour on System.Net.Dns. Resolve( hostname )
It would appear that this does more than just a DNS lookup (which is what it
says in the documentation), at least when resolving the address of the
local machine.

I have a server with two NICs and hence two IP addresses: 10.0.0.5 and
192.168.0.2. Only the latter of these has a DNS entry (mapping to the host
name 'terminus'). The former IP address is not listed anywhere (DNS or hosts
file).
If I call System.Net.Dns. Resolve( 'terminus') from the server itself, I get
both IP addresses coming back. How is this possible if the call is only
doing a DNS lookup? A test with nslookup verifies that the name 'terminus'
has a single A record only, pointing to 192.168.0.2.

My suspision is that this call is also checking the NetBIOS name cache;
"netstat -a terminus" lists the same results as the resolve call. If so,
this is not what the documentation says it does.

Any ideas anyone ?
Is it possible to do a DNS lookup ONLY on a hostname ?

Thanks in advance for any help,

Rob Levine
http://roblevine.blogspot.com


Hi,

maybe no dns lookup is being done at all, as the name matches the one of
the local machine (supposing no two machines can have the same name).
Can you verify that ? What happens if the app is run from another machine ?

Cheers,
Benoit
Nov 16 '05 #2
>
Hi,

maybe no dns lookup is being done at all, as the name matches the one of
the local machine (supposing no two machines can have the same name). Can
you verify that ? What happens if the app is run from another machine ?

Cheers,
Benoit


Hi Benoit,

I suspect you are correct. If I do the same method call from another machine
I only get one IP address back, the one from the DNS.
This leaves me with a problem though; how can I do a DNS lookup for a given
A record for a host (as if I was using something like nslookup) from the
host itself?
There would appear to be no way of doing this within .Net; short of writing
a proper DNS client (or obtaining a 3rd party one).

Any ideas?

It would be helpful if the documentation wasn't so misleading on the nature
of this method call.

Thanks for your hewlp,

Rob

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1850
by: RitaG | last post by:
Hi. I know you can send an email using System.Web.Mail but other than using the Outlook object, is there another way to read the email in an Inbox. I'm currently reading the mail in an Inbox with the Outlook object. The program works fine when deployed on my pc but when deployed to another server I get a pop-up message saying "A program is trying to access mail addresses you have stored in Outlook".
6
6741
by: Markus Wildgruber | last post by:
Hi! How can I get information about the system my application is running on? I found the System.Environment class that provides me with some of the desired information but some of them not in the form I want. For example, you can get the OS-version but when using ToString() to do the user output, it returns 'Microsoft Windows NT 5.1.2600.0' when running on Windows XP Professional. Is there a way to get a user-understandable string like...
8
7820
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's in the namespace "System.Text.RegularExpressions;" and that namespace is, in turn, defined in the namespace "System", according to MSDN at http://msdn2.microsoft.com/en-us/library/c75he57e(en-us,VS.80).aspx. So adding "using...
3
2070
by: Karl Hungus | last post by:
A cs file I compiled into an assembly dll is in my bin directory. In the cs file I have a using statement for System.Xml I compiled it using this command: csc /out:XmlContent.dll /t:library XmlContent.cs When I run my aspx page, which has a codebehind that instantiates the object from in my assembly, I get the following error, anyone know why? File or assembly name System.Xml, or one of its dependencies, was not found.
0
11268
by: Raja B | last post by:
I start getting this exception when I moved my windows service to a Windows 2003 (32 bit running on AMD Opteron processors) server with ..NET framework 2.0 . The EventLog says Event Type: Error Event Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000
0
1325
by: Neha | last post by:
When I run my test cases I gets the following error: Warning: Test Run deployment issue: The assembly or module 'System.Xml' directly or indirectly referenced by test assembly "path" was not found. Can I get some help how to resolve this issue. thanks Neha
3
4671
by: NickP | last post by:
Hi there, Today I try to compile an application of mine and I am getting a whole list of bizaar errors.... ------------------------------------------------ Error 1 The "ResolveAssemblyReference" task failed unexpectedly. System.BadImageFormatException: Could not load file or assembly 'C:\System.exe' or one of its dependencies. The module was expected to
5
8966
by: =?Utf-8?B?cnZhbmdlbGRyb3A=?= | last post by:
Hello, I have a problem with our OnlineBackupService.exe. This is a Windows Service which is built in .Net 1.1 and basically grabs files from the file system and will try to upload them using WebServices. The service is installed by default using LocalSystem account. The exact problem is that sometimes this service is not allowed to resolve the target webservice. This results in the following exception:
5
3041
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a .Net web service that converts the MODCA files to tif or png file format. This web service runs on a 2003 server. This web service first copies the MODCA file to be converted to a temporary conversion folder. Then it converts it to the desired file format and copies the file to the output folder specified. Then it deletes the converted file from the temporary conversion folder. Then it attempts to delete the copied input file...
0
7924
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.