Skip to content

Instantly share code, notes, and snippets.

@ShineSmile
Last active February 22, 2019 06:44
Embed
What would you like to do?
ASP.NET Controller register
One thing I ran into was having my configurations registered in the wrong order in my GLobal.asax file for instance:
Right Order:
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
Wrong Order:
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
WebApiConfig.Register(GlobalConfiguration.Configuration);
Just saying, this was my problem and changing the order is obvious, but sometimes overlooked and can cause much frustration.
https://stackoverflow.com/questions/15556035/all-asp-net-web-api-controllers-return-404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment