title: Consume Web API from .NET Console App
body: <p>I'm getting the following error while consuming a MVC 4.0 Web API from a .NET 4.5 Console App.
  "No MediaTypeFormatter is available to read an object of type 'IEnumerable`1' from content with media type 'text/html'."
  Please help!
  Below is my code:</p>
  
  <pre><code>HttpClient client = new HttpClient();
          client.BaseAddress = new Uri("http://localhost:30151/");
  
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
  
          //List all Customers
          HttpResponseMessage response = client.GetAsync("api/customers").Result;
  
           if (response.IsSuccessStatusCode)
          {
              var customers = response.Content.ReadAsAsync&lt;IEnumerable&lt;Customer&gt;&gt;().Result;
              foreach (var c in customers)
              {
                  Console.WriteLine("ID: {0}\tName: {1}\tAddress: {2}\tEmail: {3}\tPhone: {4}", c.id, c.name, c.address, c.email, c.phone);
              }
          }
          else
          {
              Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
          }
  
          Console.Read();
  </code></pre>