title: HttpClient is returning Internal Server Error (500) on API controller with constructor
body: <p>I am doing an Api Controller Application.</p>
  
  <p>On My Api Method I want to call a Function defined in another Project. I want to use IOC. I define an Interface and a Class that inherit from interface.</p>
  
  <p>The problem I have when I call the Controller/Method is that I have error  <code>Internal Server Error (500)</code></p>
  
  <p>I test every posibility, and it occurs because I use a Controller Constructor. If I avoid using it, is Works.</p>
  
  <p>It does not work,
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public class LoginController : ApiController
  {
  private IUserLogin _userLogin;
  
          public LoginController(IUserLogin userLogin)
          {
                _userLogin = userLogin;
          }
          [HttpPost]
          public UserToken Login([FromBody]Users user)
          {
                 return _userLogin.SetToken(user);
              
          }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>It Works without Constructor</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  public class LoginController : ApiController
      {
          [HttpPost]
          public UserToken Login([FromBody]Users user)
          {
               private IUserLogin _userLogin;
                  return _userLogin.SetToken(user);
          }
       }</code></pre>
  </div>
  </div>
  </p>
  
  <p>It Works...</p>
  
  <p>I am doing my call from WinForm like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> using (HttpClient client = new HttpClient())
              {
                  //reference nuget Microsoft.AspNet.WebApi 
                  client.BaseAddress = new Uri(apiUrl);
                  client.DefaultRequestHeaders.Accept.Clear();
                  client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                  var response = client.PostAsJsonAsync(apiUrl + "Login/Login", user).Result;
  
                  if (response.IsSuccessStatusCode)
                      userToken = response.Content.ReadAsAsync&lt;UserToken&gt;().Result;
                  else
                      throw new Exception("Error");
              }</code></pre>
  </div>
  </div>
  </p>
  
  <p>How can I use Controller Constructor and Not get any error?</p>