404 not found when trying to run Api Controller action from ASP.NET core web app

When you added API controller with actions in .net core web app and if it shows 404 not found status when trying to hit that API endpoint then

Solution:

Make sure that

In Startup.cs #ConfigureServices, you have this:

services.AddControllers();

In #Configure, you have this:

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
}




Leave a comment