I m working on Web API project, and it is using WebApiConfig.cs file to defined routs for Web API.

Web API fold RouteConfig.cs file. I have googled and they say RouteConfig.cs is for MVC routing. It is actually a confusing statement. Can you please guide why WebAPI has RouteConfig.cs file ? Why would one need MVC routing in Web API ? What function it will do ?

Thanks for your help and guidance.

1 Answer 1


The RouteConfig.cs file isn't required for Web API. It is included by default in new Web API projects because that template also includes an MVC webpage (for the index page that appears when you open the project in a browser).

If you delete both the RouteConfig.cs and the HomeController.cs file (as well as modify Global.asax.cs to not call RouteConfig.RegisterRoutes()), then your project will still compile and the API controllers will still work fine, you will just be missing a pretty homepage.

Note also that MVC Areas have their own MVC routing and do not use the global MVC routing, which is why the /Help page still works even when RouteConfig.cs has been removed.

  • thanks, awesome explanation. Just a silly question please, by "MVC Areas" what are you referring exactly ? Can you please guide.
    – user576510
    Oct 27, 2014 at 22:43
  • 1
    @user576510 This page has a good guide to MVC Areas, including this good description: To accommodate large projects, ASP.NET MVC lets you partition Web applications into smaller units that are referred to as areas. Areas provide a way to separate a large MVC Web application into smaller functional groupings. An area is effectively an MVC structure inside an application. An application could contain several MVC structures (areas).
    – Jack Scott
    Oct 27, 2014 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.