Do we still need AreaRegistration.RegisterAllAreas

2019-06-15 13:31发布

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);            

}

1条回答
够拽才男人
2楼-- · 2019-06-15 14:05

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

查看更多
登录 后发表回答