ASP.Net WebAPI 区域支持 [英] ASP.Net WebAPI area support
问题描述
我正在尝试向我的 asp.net 4 RC 站点添加一些 WebAPI 支持,并希望将其放入一个区域.我已经看到有人设法让它在测试版上运行(here) ,但老实说,我不知道我在 RC 做什么.
I am trying to add some WebAPI support to my asp.net 4 RC site, and wish to put it into an area. I have seen that someone managed to get this running on the beta (here) , but to be honest, have no idea what I am doing in the RC.
有没有人设法为 WebAPI 的 RC 添加区域支持?
Has anybody managed to add area support to the RC of WebAPI?
推荐答案
你可以把 Api 控制器放在你喜欢的任何文件夹中,你不需要像 MVC 那样创建一个区域.我通常做的是在 MVC 站点的Controllers"文件夹中创建一个子文件夹Api".只需为您的 Api 控制器注册路由即可.
You can put Api controllers in any folder you like, you don't need to create an Area like you did for MVC. What I usually do is create a subfolder 'Api' inside 'Controllers' folder of MVC site. Just register routes for your Api controllers and it will work.
这篇关于ASP.Net WebAPI 区域支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!