title: Get host entry async freezes
body: <p>I have a problem that occurs when i have deployed the code to the production server. It does not happen locally on my computer. When i run the line</p>
  
  <pre><code>var host = await Dns.GetHostEntryAsync(adresse);
  </code></pre>
  
  <p>The production environment freezes or awaits indefinitely. Why does this happen?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    public async Task&lt;string&gt; HentAsync(string ip)
      {
          if (string.IsNullOrWhiteSpace(ip) || kLoopbackIp.Contains(ip))
          {
              return string.Empty;
          }
  
          if (IpHostname.ContainsKey(ip))
          {
              UpdateAndRemoveOldElements(ip);
  
              return IpHostname[ip].Item1;
          }
  
          try
          {
              IPAddress adresse = IPAddress.None;
              if (!IPAddress.TryParse(ip, out adresse))
              {
                  return string.Empty;
              }
  
              var host = await Dns.GetHostEntryAsync(adresse);
              string hostname = host.HostName;
  
              IpHostname.AddOrUpdate(ip,
                                     new Tuple&lt;string, DateTime&gt;(hostname, DateTime.Now),
                                     (x, y) =&gt; new Tuple&lt;string, DateTime&gt;(hostname, DateTime.Now));
              return hostname;
          }
          catch (Exception)
          {
              // Tar i mot exception og returnerer tom string
              return string.Empty;
          }
      }
  </code></pre>
  
  <p>UPDATE:
  The async method is called like this from a sync method that is doing the same thing (could this be the culprit).</p>
  
  <pre><code>public string Hent(string ip)
  {
      return HentAsync(ip).Result;
  }
  </code></pre>