小编mas*_*pau的帖子

在没有MVC的纯ASP.NET Web API服务中,我们是否还需要Global.asax中的AreaRegistration.RegisterAllAreas()

我试图创建一个干净的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);            

}
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc-4 asp.net-web-api

11
推荐指数
1
解决办法
9055
查看次数

标签 统计

asp.net-mvc-4 ×1

asp.net-web-api ×1

c# ×1