Hi,
I have an controller in which i have defined multiple [HttpPost] methods and also given the [ActionName] to each method. But its not working even after updating the
Error - No action was found on the controller 'ControllerName' that matches the request.
WebApiConfig
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { Id = RouteParameter.Optional }
);
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
}
RouteConfig
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new {id = UrlParameter.Optional }
);
}
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bikesh SrivastavaPosted Jan 6, 2017, 2:15 PM
Chetan RanpariyaPosted Jan 6, 2017, 8:53 AM
Saillesh PawarPosted Jan 6, 2017, 8:29 AM