In my case, the controller was defined as:
public class DocumentAPI : ApiController
{
}
Changing it to the following worked!
public class DocumentAPIController : ApiController
{
}
The class name has to end with Controller!
Edit: As @Corey Alix has suggested, please make sure that the controller has a public access modifier; non-public controllers are ignored by the route handler!
Related Contents:
- How to add Web API to an existing ASP.NET MVC 4 Web Application project?
- Redirect from asp.net web api post action
- All ASP.NET Web API controllers return 404
- ASP.NET MVC 4 Application Calling Remote WebAPI
- ApiController returns 404 when ID contains period
- Difference between WebApiConfig.cs and RouteConfig.cs
- Difference between ApiController and Controller in ASP.NET MVC
- How to pass json POST data to Web API method as an object?
- MVC4 DataType.Date EditorFor won’t display date value in Chrome, fine in Internet Explorer
- How can I pass parameters to a partial view in mvc 4
- Return HTML from ASP.NET Web API
- ASP.NET WebApi vs MVC? [closed]
- How to add and get Header values in WebApi
- “An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page…”
- How to use sessions in an ASP.NET MVC 4 application?
- How to update a claim in ASP.NET Identity?
- How do I set the request timeout for one controller action in an asp.net mvc application
- ASP.NET MVC Razor Concatenation
- Return a JSON string explicitly from Asp.net WEBAPI?
- AutoMapper.Mapper does not contain definition for CreateMap
- What is routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”)
- How to allow only numbers in textbox in mvc4 razor
- Mixing Angular and ASP.NET MVC/Web api?
- ASP.NET MVC 4 intercept all incoming requests
- The anti-forgery token could not be decrypted
- Web API and ValidateAntiForgeryToken
- URLs with slash in parameter?
- Difference between “MapHttpRoute” and “MapRoute”?
- MVC 3 Can’t pass string as a View’s model?
- URL.Action() including route values
- MVC4: Two radio buttons for a single boolean model property
- AllowAnonymous not working with Custom AuthorizationAttribute
- WebApi Help Page Description
- The view ‘Index’ or its master was not found.
- Posting form to different MVC post action depending on the clicked submit button
- How to get current controller and action from inside Child action?
- upgrading from MVC4 to MVC5
- Razor actionlink autogenerating ?length=7 in URL?
- Is there a best practice and recommended alternative to Session variables in MVC
- IIS hijacks CORS Preflight OPTIONS request
- Call a hub method from a controller’s action
- Converting a ASP.NET MVC 3 Project to MVC 4
- MVC4 enum and radio button list
- Cross platform authentication using ASP.NET Web API
- Attribute Routing not working in areas
- Using @Html.DisplayNameFor() with PagedList
- MVC4 input field placeholder
- To allow GET requests, set JsonRequestBehavior to AllowGet
- Make ASP.NET bundling specify media=screen for CSS bundle
- Why are my style bundles not rendering correctly in ASP.NET MVC 4?