© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
5 replies
TotechsStrypper

[ASP.NET Controller] No route matches the supplied values

I'm trying to redirect my call to get the animal information from the create action method using this
return CreatedAtAction(nameof(GetById), new { Id = animal.Id }, _mapper.Map<AnimalDTO>(animal));
return CreatedAtAction(nameof(GetById), new { Id = animal.Id }, _mapper.Map<AnimalDTO>(animal));

And this is my GetById Action method
[HttpGet("{animalId}")]
        public async Task<IActionResult> GetById(int animalId, CancellationToken cancellationToken = default)
        {
            var animal = await _animalRepository.FindByIdAsync(animalId, cancellationToken);
            return animal != null ? Ok(_mapper.Map<AnimalDTO>(animal)) : NotFound("Unable to find the requested animal"); 
        }
[HttpGet("{animalId}")]
        public async Task<IActionResult> GetById(int animalId, CancellationToken cancellationToken = default)
        {
            var animal = await _animalRepository.FindByIdAsync(animalId, cancellationToken);
            return animal != null ? Ok(_mapper.Map<AnimalDTO>(animal)) : NotFound("Unable to find the requested animal"); 
        }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

No route matches supplied values but values seem to match?
C#CC# / help
4y ago
❔ ASP .NET Core Controller Default Route Issue
C#CC# / help
3y ago
✅ No route matches the supplied value. when trying put request to /venture/{id}/portfolio
C#CC# / help
2y ago
ASP.NET API Controller not returning values shown in debugger
C#CC# / help
3y ago