11

如果可能,我正在尝试创建一个干净的 ASP.NET Web API 服务而不引用 MVC 程序集。我关注了这个博客http://www.codeproject.com/Articles/615805/Creating-a-Clean-Minimal-Footprint-ASP-NET-WebAPI 但在 Global.asax 中的这一行我仍然必须导入 System.Web。 Mvc 程序集。如果我删除它会对我的 web 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);            

}
4

1 回答 1

20

如果您不使用 MVC 区域,则无需调用AreaRegistration.RegisterAllAreas()

于 2013-08-23T13:55:52.533 回答