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();
}