title: Receiving 500 internal server error even though I receive data from LINQ
body: <p>StackOverflow.</p>
  
  <p>The issue I am having today is when I send a get request to localhost:xxxxx trying to obtain a singular food item by ID, I receive a 500 internal server error. </p>
  
  <p>What I do not understand about this is, I went through the code in debugging and it shows that it finds the item from my database with all the information it needs, but when it is sending it in a "OK(food)", I receive a 500 internal service error even though it has the information. </p>
  
  <p>I am pretty new to web api, so some explanation would be appreciated. I am using Visual Studio 2015, Entity Frame Work 6, and a SQL Management Server DB.</p>
  
  <p><strong>I am sorry for posting links, it says I need 10 reputation to post images</strong></p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
              HttpClient client = new HttpClient();
              client.BaseAddress = new Uri("http://localhost:63591/");
              client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
              HttpResponseMessage response = client.GetAsync("api/foods/" + Request.QueryString["ID"]).Result;
  
              if (response.IsSuccessStatusCode)
              {
                  string foodstring = response.Content.ReadAsStringAsync().Result;
                  Food editFood = JsonConvert.DeserializeObject&lt;Food&gt;(foodstring);
                  EditFoodName.Text = editFood.FoodName;
                  EditCalories.Text = editFood.Calories.ToString();
                  EditNotes.Text = editFood.Notes;
              }
      }
  
      [ResponseType(typeof(Food))]
      public IHttpActionResult GetFood(int id)
      {
          Food food = db.Foods.Find(id);
          if (food == null)
          {
              return NotFound();
          }
  
          return Ok(food);
      }
  
  
  
  public partial class Food
  {
      [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
      public Food()
      {
          this.MealFoods = new HashSet&lt;MealFood&gt;();
      }
  
      public int FoodID { get; set; }
      public string FoodName { get; set; }
      public int Calories { get; set; }
      public string Notes { get; set; }
  
      [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
      public virtual ICollection&lt;MealFood&gt; MealFoods { get; set; }
  }
  </code></pre>
  
  <p><a href="https://i.imgur.com/8h6EaZM.png" rel="nofollow noreferrer">https://i.imgur.com/8h6EaZM.png</a></p>
  
  <p><a href="https://i.imgur.com/YkD8Ijp.png" rel="nofollow noreferrer">https://i.imgur.com/YkD8Ijp.png</a></p>