title: Web API error on localhost
body: <p>I am starting developing an Web API using ASP.NET Core MVC. I have been following this Microsoft tutorial: <code>https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api</code></p>
  
  <p>So far, I have created the code for the following operations:</p>
  
  <ul>
  <li>GET /api/todo</li>
  <li>GET /api/todo/{id}</li>
  </ul>
  
  <p>Code:</p>
  
  <pre><code>[Route("api/[controller]")]
  public class TodoController : Controller
  {
      private readonly ITodoRepository _todoRepository;
  
      public TodoController(ITodoRepository todoRepository)
      {
          _todoRepository = todoRepository;
      }
  
      // GET: api/values
      [HttpGet]
      public IEnumerable&lt;TodoItem&gt; GetAll()
      {
          return _todoRepository.GetAll();
      }
  
      // GET api/values/5
      [HttpGet("{id}", Name ="GetTodo")]
      public IActionResult GetById(long id)
      {
          var item = _todoRepository.Find(id);
  
          if(item == null)
          {
              return NotFound();
          }
  
          return new ObjectResult(item);
      }
  }
  </code></pre>
  
  <p>However, when I run the Application I am getting the following 500 error:</p>
  
  <p><a href="https://i.stack.imgur.com/MGbsm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MGbsm.png" alt="enter image description here"></a></p>
  
  <p>I understand what the error means, by not why it's happening. Did I miss something?</p>
  
  <p>The interesting part is that I can access the API that was autogenerated when creating the application. But not the new one I added manually.</p>