title: While processing template api/[TodoController], a replacement value for the token TodoController could not be found
body: <p>I'm new to this and following this <a href="https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-2.2&amp;tabs=visual-studio" rel="noreferrer">.Net ASP.NET wep api tutorial</a> but cant get past this error. When doing the "Test the GetTodoItems method" and running the Postman to get/set against the DB.</p>
  
  <p>When I start debugging, Chrome launches and the following error is thrown:</p>
  
  <blockquote>
    <p>System.InvalidOperationException: 'The following errors occurred with
    attribute routing information:</p>
    
    <p>Error 1: For action: 'TodoApi.Controllers.TodoController.GetTodoItems
    (TodoApi)' Error: While processing template 'api/[TodoController]', a
    replacement value for the token 'TodoController' could not be found.
    Available tokens: 'action, controller'. To use a '[' or ']' as a
    literal string in a route or within a constraint, use '[[' or ']]'
    instead.</p>
    
    <p>Error 2: For action: 'TodoApi.Controllers.TodoController.GetTodoItem
    (TodoApi)' Error: While processing template
    'api/[TodoController]/{id}', a replacement value for the token
    'TodoController' could not be found. Available tokens: 'action,
    controller'. To use a '[' or ']' as a literal string in a route or
    within a constraint, use '[[' or ']]' instead.'</p>
  </blockquote>
  
  <p>This is my controller code straight from the tutorial:</p>
  
  <pre><code>using Microsoft.AspNetCore.Mvc;
  using Microsoft.EntityFrameworkCore;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using TodoApi.Models;
  
  namespace TodoApi.Controllers
  {
      [Route("api/[TodoController]")]
      [ApiController]
      public class TodoController : ControllerBase
      {
          private readonly TodoContext _context;
  
          public TodoController(TodoContext context)
          {
              _context = context;
  
              if (_context.TodoItems.Count() == 0)
              {
                  // Create a new TodoItem if collection is empty,
                  // which means you can't delete all TodoItems.
                  _context.TodoItems.Add(new TodoItem { Name = "Item1" });
                  _context.SaveChanges();
              }
          }
  
          // GET: api/Todo
          [HttpGet]
          public async Task&lt;ActionResult&lt;IEnumerable&lt;TodoItem&gt;&gt;&gt; GetTodoItems()
          {
              return await _context.TodoItems.ToListAsync();
          }
  
          // GET: api/Todo/5
          [HttpGet("{id}")]
          public async Task&lt;ActionResult&lt;TodoItem&gt;&gt; GetTodoItem(long id)
          {
              var todoItem = await _context.TodoItems.FindAsync(id);
  
              if (todoItem == null)
              {
                  return NotFound();
              }
  
              return todoItem;
          }
      }
  
  }
  </code></pre>
  
  <p>Here is the startup.cs</p>
  
  <pre><code>using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Hosting;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.EntityFrameworkCore;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.DependencyInjection;
  using TodoApi.Models;
  
  namespace TodoApi
  {
      public class Startup
      {
          public Startup(IConfiguration configuration)
          {
              Configuration = configuration;
          }
  
          public IConfiguration Configuration { get; }
  
          // This method gets called by the runtime. Use this method to add services to the 
          //container.
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddDbContext&lt;TodoContext&gt;(opt =&gt;
                  opt.UseInMemoryDatabase("TodoList"));
              services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP 
          //request pipeline.
          public void Configure(IApplicationBuilder app, IHostingEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
              else
              {
                  // The default HSTS value is 30 days. You may want to change this for 
                  // production scenarios, see https://aka.ms/aspnetcore-hsts.
                  app.UseHsts();
              }
  
              app.UseHttpsRedirection();
              app.UseMvc();
          }
      }
  }
  </code></pre>