ASP.NET Web API error after upgrading to Visual Studio 2012 RC: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation

前端 未结 4 1887
终归单人心
终归单人心 2020-12-18 23:28

After upgrading to Visual Studio 2012 I can no longer access any of my ApiControllers, the following error is thrown:

Server Error in \'/\' Application.

Met         


        
4条回答
  •  無奈伤痛
    2020-12-19 00:05

    This fixed it for me.

    http://forums.asp.net/t/1809919.aspx/1
    

    Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1)'.

    I resolved it with the following steps. Not sure if all of them are required, but it worked.

    In NuGet Package Manager, uninstalled the Web.API Beta package. Added references to System.Net.Http, System.Web.Http, & System.Web.Http.WebHost (these were removed by the previous step). Installed Json.Net via NuGet.

    As an addition, if your project is targeting the 4.0 version of the framework, you must include the new Microsoft ASP.Net Web API set of packages from NUGET, to get a green light for your build. Json.Net is a dependency for these new packages, so you need not install it separate.

提交回复
热议问题