Difference between WebApiConfig.cs and RouteConfig.cs

后端 未结 3 1344
长情又很酷
长情又很酷 2021-02-11 13:28

What is the difference between WebApiConfig.cs and RouteConfig.cs in the App_Start folder of an MVC Web API project in Visual Studio 2012?

3条回答
  •  抹茶落季
    2021-02-11 13:50

    The following are the key differences:

    1. RouteConfig.cs is exclusively for configuring ASP.NET routes.
    2. WebApiConfig.cs is for any Web API related configuration, including Web-API-specific routes, Web API services, and other Web API settings.

    As cmotley mentions, the ASP.NET web site includes a good listing of what types of configuration can be done in WebApiConfig.cs in this article.

提交回复
热议问题