WebAPI routing does not work

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


WebAPI routing does not work



I have WebApiConfig


public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}



Web API controller:


[RoutePrefix("api/Trip")]
public class TripApiController : ApiController
{
[Route("SaveRouting")]
[HttpPost]
public async Task<HttpResponseMessage> SaveRouting(string points, int tripId, decimal totalMileage)
{
// ......
return Request.CreateResponse(HttpStatusCode.OK);
}



and call from jquery:


$.post("/api/trip/SaveRouting",
{ points: JSON.stringify(arrayStops), tripId: $("#hdTripId").val(), totalMileage: tMiles },
function(resp) {
App.unblockUI(blockElRouting);
});



it tries to call, but failure:



enter image description here



App Insights says:



enter image description here



what is invalid?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results