How to do DNS lookup in a Windows Azure web role?

463 Views Asked by At

I download DnDNS from http://dndns.codeplex.com/ and get it work at local IIS.

sample code:

request.Resolve("8.8.8.8", domain_a_string, NsType.MX, NsClass.INET, ProtocolType.Udp, null);

but on Windows Azure, not work, it says cannot connect to the DNS server, no response (or dropped)

Then, I tried 4.2.2.4 and plenty other public DNS server, none work.

Does anyone here have a working code or other DNS lookup solution for Azure?

2

There are 2 best solutions below

2
On BEST ANSWER

I believe DNS works via UDP, and in Windows Azure, UDP traffic isn't routed. You'll need to use the DNS server inside Windows Azure. If there's a way with that library to just use the default DNS server Windows is configured to use, that should work. If not, you might derive some inspiration from http://smarxrole.codeplex.com/SourceControl/changeset/view/3accd48815c3, which is a PowerShell script that gets the right DNS server in Windows Azure.

0
On

Check out StatDNS which allows you to perform DNS queries over HTTP, and to get reverse PTR records for both IPv4 and IPv6 addresses @ https://github.com/ghuntley/statdns