Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we still need AreaRegistration.RegisterAllAreas() in Global.asax in pure ASP.NET Web API service without MVC

I'm trying to create a clean ASP.NET Web API service without referencing MVC assemblies if possible. I followed this blog http://www.codeproject.com/Articles/615805/Creating-a-Clean-Minimal-Footprint-ASP-NET-WebAPI but with this line in Global.asax I still have to import System.Web.Mvc assembly. Would there be an impact in my web api service if I removed it? I tried running my service in my local without it and I did not encounter any error.

protected void Application_Start()
{
        //AreaRegistration.RegisterAllAreas(); do we still need this?

        WebApiConfig.Register(GlobalConfiguration.Configuration);  
        HandlerConfig.RegisterGlobalHandlers(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalConfiguration.Configuration.Filters);            

}
like image 538
masterlopau Avatar asked Aug 23 '13 13:08

masterlopau


1 Answers

If you're not using MVC areas then there should be no need to call AreaRegistration.RegisterAllAreas()

like image 105
chris.house.00 Avatar answered Oct 29 '22 20:10

chris.house.00



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!