Over a million developers have joined DZone.

Short Walks: 406 Error While Creating a .NET Core API

DZone's Guide to

Short Walks: 406 Error While Creating a .NET Core API

If you've come across this situation with .NET Core, then we have a solution for you. Read on to learn more!

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

I'm afraid this is another of those: "What has AddMvc() ever done for us" posts. Today, I was creating a brand new .NET Core 2.1 API and, instead of calling AddMvc in ConfigureServices, I instead used AddMvcCore:

public void ConfigureServices(IServiceCollection services)

When I tried to access the API, I got a 406 error. The fix is very simple (and one that using AddMvc()  does for you:

public void ConfigureServices(IServiceCollection services)

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.

web dev ,api ,.net core ,http errors ,c#

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}