title: System.Net.Http.HttpRequestException: 'Request failed with status code InternalServerError'
body: <p>This exception is thrown when I need to call the Registry of my project and get all services displayed in client.It worked yesterday but dont know why its not working now.Can anyone help with me with this?</p>
  <p><a href="https://i.stack.imgur.com/EidKw.png" rel="nofollow noreferrer">This is my method to get all services to client from the registry api</a></p>
  <pre><code>private void btnGetAll_Click(object sender, RoutedEventArgs e)
      {
          Services services;
          User user = User.Instance;
  
          //Api Call is made.
          string url = &quot;http://localhost:14470/api/AllServies/ &quot; + Rtoken;
  
          var clinet = new RestClient(url);
          var request = new RestRequest();
          var response = clinet.Post(request);
          List&lt;Services&gt; data = new List&lt;Services&gt;();
          data = JsonConvert.DeserializeObject&lt;List&lt;Services&gt;&gt;(response.Content.ToString());
          List&lt;Services&gt; gridData = new List&lt;Services&gt;();
          foreach (Services line in data)
          {
  
              //services = JsonConvert.DeserializeObject&lt;List&lt;Services&gt;&gt;(line);
              /*if (services.Status.Equals(&quot;Denied&quot;))
              {
                  logout();
                  break;
              }*/
              gridData.Add(line);
          }
          // Services test = serviceInfo.SelectedItem as Services;
          serviceInfo.ItemsSource = gridData;
      }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/PN8Ka.png" rel="nofollow noreferrer">This is the all service controller of my registry api</a></p>
  <pre><code>// POST: api/AllServices
      [Route(&quot;api/AllServies/{token}&quot;)]
      [HttpPost]
      public IHttpActionResult Post([FromBody] int token)
      {
          //AuthInterface foob = auth.initServerConnection();
          // Ilist return for returning list with multple types
          //token validation
          string validate = foob.Validate(token);
          if (validate.Equals(&quot;Not Validated&quot;))
          {
              //if valid token
  
              // path to the text file
              string path = &quot;C:\\Users\\ravin\\Desktop\\assignment_1_DC\\Services.txt&quot;;
              List&lt;string&gt; services = File.ReadAllLines(path).ToList();
  
              List&lt;Rdetails&gt; regservice = new List&lt;Rdetails&gt;();
  
              //checking for every line
              foreach (var service in services)
              {
                  //deserlizing text and assigning values to RegistryDetail type object
                  Rdetails rDetail = JsonConvert.DeserializeObject&lt;Rdetails&gt;(service);
  
                  // add details to the created Registry details type list
                  regservice.Add(rDetail);
  
              }
  
              return Ok(regservice);
  
          }
          else
          {
              // if token is unvalid
  
              Rresponse reg = new Rresponse();
              
              reg.RegStatus = &quot;Denied&quot;;
              reg.RegReason = &quot;Authentication Error&quot;;
              List&lt;Rresponse&gt; output = new List&lt;Rresponse&gt;();
              output.Add(reg);
  
              return Ok(output);
          }
      }
  }
  </code></pre>
  <p>}</p>