// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); DependencyConfig.RegisterTypes(services); // In production, the Angular files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = "ClientApp/dist"; }); }
public static void Register(HttpConfiguration config) { var container = new UnityContainer(); DependencyConfig.RegisterTypes(container); config.DependencyResolver = new UnityDependencyResolver(container); config.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.None; // Web API configuration and services config.Formatters.Remove(config.Formatters.XmlFormatter); // Web API routes config.MapHttpAttributeRoutes(); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); //config.EnableCors(new EnableCorsAttribute("*", "*", "*")); }