I need a controller to return JSON to be consumed by JavaScript so I inherited from the ApiController class but it isn\'t behaving as I expected. The Apress bo
If you want Web API to look for the action name when routing, change the WebApiConfig.cs class in the App_Start folder to this:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Then you can just make a GET request to
http://mysite/api/Services/MethodFruit