here is the startup ruinning controller method in web application:
public ActionResult PaginationOfBooks(string _title, string _author, string _description, string _publisher) { HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:57752"); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage response = client.GetAsync("api/Book/GetBooks").Result; rest is not important yet. Actually at this point, in debug mode I expect to switch WebApi project that in same solution with Web app, GetBooks method I have break point at first line of this method.. here is the content of result:
StatusCode: 404, ReasonPhrase: 'Not Found', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: my web abi project:
public ActionResult GetBooks(string _title, string _author, string _description, string _publisher) { var draw = 1; ... webapi config:
public static class WebApiConfig { public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/Book/{id}", defaults: new { id = RouteParameter.Optional } ); config.Formatters.Remove(config.Formatters.XmlFormatter); config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); } } how can I get this web api request?
I run api project and simply tried to access method with this: 