Why am I getting a 404 response from my POST in web api?

Viewed 27271

I have the following action in my Web api controller:

 // POST api/<controller>
    [AllowAnonymous]
    [HttpPost]
    public bool Post(string user, string password)
    {
         return true; 
    }

I am getting the following error with a 404 status when hitting it with either fiddler or a test jQuery script:

{"Message":"No HTTP resource was found that matches the request URI 'http://localhost/amsi-v8.0.0/api/account'.","MessageDetail":"No action was found on the controller 'Account' that matches the request."}

My http route is as follows:

            RouteTable.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );

Gets work fine. I found another question here which talks about removing WebDAV from IIS. I tried that, still same issue.

Why do I get a 404?

2 Answers
Related