Delen via


Tips And Tricks

Planning on updating this section regularly with some Tips, Tricks and some TroubleShooting techniques. So if you have any, please post in the comments, I'll add it to the article

Tips:

1. Enable IPV6 on your machine: In WinXP SP2 / Win2k3, Execute netsh int ipv6 install. In Vista, it is enabled by default.

 

 

TroubleShooting:

1. BackGroundInfo: Dns.GetHostEntry(hostname) returns IPHostEntry, from which the IPAddresses for the host can be obtained. If you pass in the actual hostname, then the IPAddresses corresponding to the host are returned. When localhost is passed as the hostname, the address 127.0.0.1 is returned.

Situation: Eventhough you pass in the actual hostname, do you get 127.0.0.1?

TroubleShooting Tip: Check your network connectivity. When the Dns server cannot be contacted to get the ipaddresses, 127.0.0.1 is returned.

2. Situation: No ipv6 addresses are returned from Dns.Resolve API.

TroubleShooting Tip:

1. Do a ipconfig to see if any ipv6 addresses are displayed. If not, then ipv6 is not installed on machine. So enable ipv6 using command netsh int ipv6 install.

2. Check the config file to see if ipv6 is enabled in machine.config (under path %windir%\microsoft.Net\Framework\<version of framework>\config\machine.config)

<system.net>
<settings>
<ipv6 enabled="true" />
</settings>
</system.net>

In Whidbey, if the machine.config doesn't  have these settings, add them under the configuration tag. In Everett these tags were mandatory. So you might want to just change the boolean value for the enabled attribute

MoreInfo: Dns.GetHostEntry, Dns.GetHostAddresses are new APIs for whidbey and they are not affected by the ipv6 enabled switch in the config file. To maintain compatibility with everett, old APIs like Dns.Resolve still use the ipv6 enabled switch to decide on the addresses returned.