Skip to content

Instantly share code, notes, and snippets.

@ShineSmile
Last active February 22, 2019 06:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ShineSmile/b4a58d36bda572d662100e1091423907 to your computer and use it in GitHub Desktop.
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