October new recruits, receive a project to use webapi, when the company's human hair incomplete project, I have written api, but also how not to visit, is very confusing, so read the information,
We found less a WebApiConfig.cs file folder in App_Start
public static class WebApiConfig { public static void Register(HttpConfiguration config) { // Web API 配置和服务 // Web API 路由 config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } }
And also like to add one in the Global.asax file
GlobalConfiguration.Configure(WebApiConfig.Register);
Not previously been configured webapi things, spent a little effort ,,,, actually create a new projects are directly webapi these configurations.
20,191,110 note