In the last couple of days we have some problem on our Azure Web App (S3 WebSite hosted in North Europe data center) when resolving host names.

We have created a very simple .aspx page that try to resolve google.com and sometime we receive the correct ip other times we get this error:

System.Net.Sockets.SocketException (0x80004005): No such host is known at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6) at System.Net.Dns.Resolve(String hostName) at ASP._diagnostics_dns_aspx.HostName2IP(String hostname) at ASP._diagnostics_dns_aspx.Resolve(Object sender, EventArgs e)

The same problems occurs when resolving internal azure host names (*.cloudapp.azure.com) or other host names (microsoft.com, ...).

Our suspect is that one of the instance where the app is hosted (we currently have 2 instances) have the dns resolution broken.

You can see the full aspx page code here: https://gist.github.com/davideicardi/6d3f5bf45efaeea0e2a03cba58beec5f

But basically it use the following code to resolve the requested host name:

  private string HostName2IP(string hostname)
      var iphost = System.Net.Dns.GetHostEntry(hostname);
      var addresses = iphost.AddressList;
      var addressList = new System.Text.StringBuilder( );
      foreach(var address in addresses)
          addressList.Append("IP Address: ");
          addressList.Append(address.ToString( ));
      return addressList.ToString( );

Any idea? It is possible that we have broken some configuration or there is a problem in Azure?

UPDATE: If I use [System.Net.Dns]::GetHostEntry("google.com") or using nslookup inside the Kudu PowerShell console the name is always resolved. Seems to be a problem related to my website only. I have tried on both instances.

  • If it's working in Powershell, it should work in your website. I see from the code that you have a loop, are you iterating quickly a large number of times or just querying once? Also, does it fail consistently for a period of time or come back immediately after failing once?
    – garbrad
    Sep 5 '16 at 16:50
  • It seems that on a specific instance it fail consistently. I have added a loop just for test but if fail once then it will fail always. But only on that instance (I print the machine name). Unfortunately from some days I'm not able to reproduce it because Azure has changed my instance and now we are on different machines. I really suspect it was a problem on a particular server... Sep 6 '16 at 7:54
  • If it happens again, please raise a support request in the Azure portal, the webapp team will be able to find the instance it's on and check network etc.
    – garbrad
    Sep 6 '16 at 9:29

I have an open ticket with MS that seems to confirm that it was bug on Azure side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.