using Owin; using System.Web.Http; namespace ThCardReader { class Startup { public void Configuration(IAppBuilder appBuilder) { HttpConfiguration config = new HttpConfiguration(); // 启用属性路由 config.MapHttpAttributeRoutes(); // 主要的API入口路由 config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); // 读卡器专用API路由 config.Routes.MapHttpRoute( name: "ReadCardApi", routeTemplate: "readcard/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); appBuilder.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll); appBuilder.UseWebApi(config); } } }