ASP.NET Core Web API HTTP POST returns 404 in Azure

I have this (simplified) ASP.NET Core Web API controller. Both GET and POST actions work fine on my machine. However, deployed to Azure, only the GET action works correctly. POST action leads to 404. Any ideas?

namespace Foo
{
  using System;
  using System.Collections.Generic;
  using Microsoft.AspNetCore.Mvc;

  [RequireHttps]
  [Produces("application/json")]
  [Area("Foo")]
  [Route("[area]/Api/[controller]")]
  public class BarController : Controller
  {
    [HttpGet]
    public IEnumerable<string> Get()
    {
      return new[] {"Hello", "World!"};
    }

    [HttpPost]
    public void Post([FromBody] InputModel model)
    {
    }

    public class InputModel
    {
      public int Foo { get; set; }
    }
  }
}

This is an ASP.NET Core MVC application aimed at the full .NET platform. It is being deployed as the Azure Web App. I tested both actions on my local machine and in Azure using Postman .

+6
source share
1 answer

It seems that with certain errors in the controller, the ASP.NET core returns 404 instead of the more appropriate 500. Check this message:

POST ASP.NET Core 2.0, 404 Azure

( , ), - .

, , , - .

, POST, . 404, , - .

+2

All Articles