Postman getting 404 error for simple ASP.NET Core Web API

Why is Postman receiving a 404 error for this route?

The issue was the controller token [controller] was missing from the route template on the controller, causing the route to be hard-coded to api/controller.

That meant that when requesting api/entities it technically did not exist and thus 404 Not Found when requested.

Update the route template on the controller.

[Route("api/[controller]")]
public class EntitiesController : Controller {
    private readonly ApplicationDbContext dbContext;

    public EntitiesController(ApplicationDbContext _dbContext) {
        this.dbContext = _dbContext;
    }

    //GET api/entities
    [HttpGet]
    public async Task<IActionResult> GetEntities() {
        var result = await dbContext.Entities.ToListAsync();
        return Ok(result);
    }
}

Reference Routing to controller actions in ASP.NET Core : Token replacement in route templates ([controller], [action], [area])


Your route is "api/controller", not "api/entities". You need to put square brackets around "controller" for the desired effect - "api/[controller]".