I'm having an issue where my .NET web requests are always hitting the same IP for a given CNAME. The CNAME is bound to multiple IP addresses, and those IP addresses are returned in a random order each time a DNS lookup occurs (confirmed via running nslookup).
I wrote a simple app to test this:
public void TestDNS()
{
while (true)
{
var ipAddress = Dns.GetHostAddresses("mywebsite.com").First().ToString();
Console.WriteLine(string.Format("Current: '{0}' at: '{1}'", ipAddress, DateTime.Now.ToLongTimeString()));
Thread.Sleep(1000);
}
}
I have run this app on Server 2008 Datacenter, Server 2008 R2 Datacenter, Server 2012, Windows 7, and Windows 8. All machines had the latest updates and service packs available.
The only machine that fails is Server 2008. Every other machine switches the IP address about once a minute (the TTL is 1 minute). Server 2008 never switches (ran for over an hour).
To be clear, running nslookup and other tools on the machine seems to indicate that DNS is returning exactly what I'd expect. This issue seems to be specific to .NET on Server 2008.
I have tried the items listed in this related answer with no success.
Any ideas?