No route matches supplied values but values seem to match?
Hi I am getting this error on return CreatedAtAction:
But how are the route values incorrect when im giving it productId and the userId? To note, they also exist in the same controller and user.Id + productId are both guids (productId comes from parameter).Dont really understand what im missing here, let me know if you need me to provide more information
18 Replies
Could be because of the cancellation token?
Never in my life have I seen a controller action that would take a cancellation token
oh
I just assumed its used there lmao
cause I was using it everywhere else
ok I removed cancellation token
but I still get the same error
Could you show the updated code?
Yep gimme a sec
I wonder if making the return type
Task<IActionResult<UserResponse>>
would change anything... I don't think it would, but might be worth a shot
Everything else looks perfectly fineAlright let me try
I get this
Ah, so
ActionResult<UserResponse>
oh whops
I can never remember if it's the interface or the actual type that's generic, my bad
Ok I get the same error
its been driving me nuts
because it seems fine as you said
I even googled examples on how to use CreatedOnAction and tried following them 1:1 lol
Could something in my service be affecting it..? even though ive debugged it and it does reach all the way down to CreatedOnAction...
Two more thoughts:
1. Try writing the action name manually instead of
nameof()
. Try "GetById"
, "getbyid"
, "getbyidasync"
, different combinations
2. In the route parameters object, try passing only one of them, either the productId
or the id
Trial and error is all I can come up with lolSame issue
the creation of the account goes through succesfully though
Weird
Oh
Its because of Async suffix in my action name
apparently thats not allowed when using createdataction...
Huh
GitHub
Getting System.InvalidOperationException: No route matches the supp...
[HttpPost] public async Task<IActionResult> PostAsync(RequestUserDto requestUserDto) { if (ModelState.IsValid && requestUserDto.RoleId != Guid.Empty) { MOM.Data.Entity...
found this lol
Yeah now it works
wow