Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Action in MVC Web API controller not firing

$
0
0

I have an ASP .Net Core 1.1 MVC Web Api. In it, I have a controller that doesn't seem to be working. When I navigate to one of it's actions (it only has one) it doesnt trigger:

namespace InspectionsWebApi.Controllers
{
    [Produces("application/json")]
    [Route("api/ValidateUsers")]
    public class ValidateUsersController : Controller
    {
        private readonly InspectionsContext _context;
        private readonly ILogger<UsersController> _logger;

        public ValidateUsersController(InspectionsContext context, ILogger<UsersController> logger)
        {
            _context = context;
            _logger = logger;
        }

        // GET: api/ValidateUsers/abcde12345
        [HttpGet("nameIdentifier")]
        public async Task<IActionResult> ValidateUser([FromRoute] string nameIdentifier)
        {
            // This code never fires
        }
    }
}

and I navigate to

    http://localhost:50082/api/validateusers/john123

I get a 404 error.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>