I am using MVC 3 application and used web api controller.
I want to call a method with parameters .
But when I try to call the method I get Internal Server error(500)
My global.asax is:
routes.MapHttpRoute(
name: "PostMethod2",
routeTemplate: "api/mycontroller/{a}/{b}",
);
Should I add any code to application_start of Global.asax to route to the parameterized method?
Your route configuration doesn’t seem legit, a proper one would look like below
Note, “{controller}” and “{action}” can’t be random. MVC uses it to map to your controller and action(method) respectively. {a} will be mapped to your parameter “int a”. MVC uses mapping by convention.