簡體   English   中英

在沒有MVC的純ASP.NET Web API服務中,我們是否還需要Global.asax中的AreaRegistration.RegisterAllAreas()

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

我試圖創建一個干凈的ASP.NET Web API服務,如果可能的話,不引用MVC程序集。 我關注了這個博客http://www.codeproject.com/Articles/615805/Creating-a-Clean-Minimal-Footprint-ASP-NET-WebAPI但是在Global.asax中使用這一行我還是要導入System.Web。 Mvc組裝。 如果我將其刪除,會對我的網絡API服務產生影響嗎? 我嘗試在沒有它的情況下在我的本地運行我的服務,我沒有遇到任何錯誤。

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

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

}

如果您沒有使用MVC區域,那么就不需要調用AreaRegistration.RegisterAllAreas()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM