-
Notifications
You must be signed in to change notification settings - Fork 708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using cancellationToken returns UnsupportedMediaType #534
Comments
Hmm... I've never seen this before. I personally use CancellationToken all the time. There is a special model binder provided by ASP.NET Core out of the box that wires this up. API Versioning does not muck with that. I wasn't able to repro this. Do you happen to have the simplest repro you can share? That will make investigating the issue much faster. Thanks. |
It can be related to dotnet/aspnetcore#4396 |
Thanks for the responses. |
Ah ... yes. I'm glad you got that ironed out. There was a behavioral change back in the initial 3.0 timeframe I believe it was. There is a convention mechanism to disambiguate API controllers from UI controllers. Previously this was no so easy way to do that. There were a number of people hosting both together and were frustrated by the versioning policies applied onto UI controllers. Unfortunately, the side effect is that API-only controller projects who were not using the new API Conventions (e.g. The policy is defined by the IApiControllerFilter service. You can extend or replace the default policy to suite your needs. |
HI,
I have exiting ASP .Net core project targeting netcoreapp 2.1.
I have taken dependency on latest Aspnetcore versioning package - "Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.5" />.
Added to the startup
I added a new controller
I get "UnsupportedMediaType" error when I try to reach this controller with a valid URL. When I remove "CancellationToken" from the controller it works fine.
Any ideas on what might be going wrong here? I also tried by upgrading my project to netCoreapp 2.2 but still the same result.
The text was updated successfully, but these errors were encountered: