This project is read-only.

Running Web API on .NET 4.5

Topics: ASP.NET Web API
Sep 5, 2012 at 2:36 PM
Edited Sep 5, 2012 at 2:51 PM

I'm using a vanilla Web API project in Visual Studio 2010, I have MVC 4 installed and I have .NET 4.5 installed.

When I reference a Web API controller I'm hit with the following exception:


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


From what I have been able to find the Web API currently released is .NET 4.0 only, so are the nightly builds - I need to get a beta of Web API which works with .NET 4.5. Is this the fix and how can I get my hands on it?


Sep 5, 2012 at 5:18 PM

You get this exception when you have two different versions of System.Net.Http.dll on the same box. This can happen when you install different released versions of .NET 4.5 and MVC 4. I recommend uninstalling MVC 4 and .NET 4.5 and then reinstalling the latest RTM versions of both.

Sep 5, 2012 at 10:29 PM

This fixed my issue - uninstalled MVC and .NET 4.5 and installed MVC 4 and .NET 4.5 again and things work like a charm :)