2013-11-26 20 views
1

由於Web API 2的新功能,我最近使用Web API 1將MVC4解決方案升級爲帶有Web Api 2的MVC5解決方案。我跟蹤了these official upgrading steps,並啓動並運行了我的解決方案。我的System.Web.Http(引用自C:\ Program Files文件(x86)\ Microsoft ASP.NET \ ASP.NET Web Stack 5 \包\ Microsoft.AspNet.WebApi.Core.5.0.0 \ LIB \ net45 \ System.Web.Http.dll)。如果我比較我的5.0.0.0 System.Web.Http dll與從互聯網下載的工作Web API 2解決方案中的DLL,類如ContinuationResult,FormattedContentResult,HttpVerbAttribute,NonActionAttribute,4覆蓋..- snip - .. Attributes,RouteAttribute缺少Web API 2.0中屬性路由的類:兩個不同的System.Web.Http 5.0.0.0 dll的?

看起來像所有新的Web API 2功能缺失,雖然我使用正確的參考。 這怎麼可能?

+0

今天我打消了我所有的4.5.x框架和Visual Studio 2013重新安裝它。可悲的是這並沒有解決任何問題。 – Gigi2m02

回答

1

看起來像我正在閱讀的Web Api 2.0教程使用了System.Web.HTTP的預發佈版本。在谷歌的'example-application-foldername'愚蠢的搜索把我帶到this article on asp.net forum

changeset on codeplex得知我丟失的類在重構後被刪除。 Some changes were made after the Release Candidate,簡稱:相反

[Route("actors/{actorId}/movies")] // Web API 2.0 Official release 

這個:自V5.0在RTM去,你應該使用屬性路由這樣

[HttpGet("actors/{actorId}/movies")] //Web API 2.0 prerelease