In my visual studio 2012, I have a solution with several projects and one of them is web. In this project, I would like to include a "Web Api Controller" class to do some testing.
I created a class with the name ValuesController, with all the necessary methods. I created a simple .aspx page and put the ajax code to call the api, but the browser gives the answer that it could not find the resource it needed (/ View / api / Values).
When I do exactly the same thing in a new web project, the system runs without problem.
Has anyone ever faced this problem or even managed to help?
Follow the details:
Global.asax.cs Method
void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = System.Web.Http.RouteParameter.Optional }
);
}
Jquery function for calling the server method:
ValuesController.cs
Project Structure