Tuesday, February 21, 2017

Help my ASP.NET Core API returns a 406 status code

Yesterday I got into trouble when invoking a specific REST API created in ASP.NET Core. Instead of getting some JSON data back from the server I got a 406 status code instead.

I had no clue what was causing the issue. Luckily a colleague helped me out. I made a dumb mistake.

I added the [Produces()] attribute to my Web API controller. However I accidently added an invalid content type:

[Produces("listvalues/json")] instead of [Produces("application/json")] Confused smile

Thanks Michael for solving the problem!

No comments: