Eric Yin
Eric Yin

Reputation: 8973

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

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?

Upvotes: 2

Views: 472

Answers (2)

Geoffrey Huntley
Geoffrey Huntley

Reputation: 506

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

Upvotes: 0

user94559
user94559

Reputation: 60143

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.

Upvotes: 2

Related Questions