protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var dataFolder = Server.MapPath("~") + "\\..\\DATA"; WebApiServicesConfig.Configure(dataFolder); }
public static void Register(HttpConfiguration config) { // Web API configuration and services //Implement global model state validation config.Filters.Add(new ValidateModelAttribute()); //Implement a Unity IoC container config.DependencyResolver = WebApiServicesConfig.GetUnityResolver(); // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); }