Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb Api route not found
    primarykey
    data
    text
    <p>I have already researched many of the questions regarding this topic. I'm no slouch when it comes to MVC3 but for the life of me I can't figure out why my Web Api in MVC 4 routing is failing. </p> <p>Fiddler2 shows a server response 404 (No Found)</p> <p>IN App_Start/WebApiConfig.cs</p> <pre><code>config.Routes.MapHttpRoute( name: "DefaultApiGet", routeTemplate: "api/{domain}/{controller}", defaults: new { action = "Get" }, constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) } ); config.Routes.MapHttpRoute( name: "ApiPostWithAction", routeTemplate: "api/{domain}/{controller}/{action}", defaults: new { action = "Post" }, constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) } ); config.Routes.MapHttpRoute( name: "DefaultApiPost", routeTemplate: "api/{domain}/{controller}", defaults: new { action = "Post" }, constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) } ); config.Routes.MapHttpRoute( name: "ControllerAndId", routeTemplate: "api/{domain}/{controller}/{id}", defaults: null, constraints: new { id = new GuidConstraint() } // Only Guids ); </code></pre> <p>IN Controllers/Api/[ModelName]Controller</p> <pre><code> [ActionName("CustomerLogin")] [HttpPost] //public HttpResponseMessage CustomerLogin(string username, string password) public HttpResponseMessage PostCustomerLogin(string username, string password) { </code></pre> <p>CALL PATH FROM CLIENT</p> <pre><code>var url = "api/[client_specific_name]/Customer/CustomerLogin"; var userData = new {username:[someusername], password:[somepassword]}; var defaultSettings = { type: 'POST', data: userData }; // SENT TO SERVER VIA AJAX ALONG WITH THE DATA ABOVE </code></pre> <p>Can't find the what I'm missing.</p> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload