This is the first time I am creating a Web API application in ASP.NET MVC4. I opened a new Web API project and added a new controller named \'Product\'. The function given below
Using NuGet to install the Web API2 Core lib. dll. You may have to update Nuget before install ing Web API2 because some components in API2 not compatible with old Nuget package. I had done this way and problem was resolved.
Check with this link to get the namespace for IHttpActionResult and all.
This package contains everything you need to host ASP.NET Web API on IIS. ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
To install Microsoft ASP.NET Web API 2, run the following command in the Package Manager Console Or Manage NuGet Packages
PM> Install-Package Microsoft.AspNet.WebApi -Version 5.0.0
I had similar problem & re installation will solve this issue. Just go to Tools > NuGet Package Manager > Package Manager Console in Visual Studio 2013 and write down the following :-
PM> update-Package Microsoft.AspNet.WebApi –reinstall
Then, Clean the solution and Build/Rebuild the solution.
Note: In my case, the process explicitly checked out Web.config and packages.config file and also removed the System.Web.Http dll file.
FYI I was getting the same issue when using .NET Core 3.1.
The solution was to use IActionResult
instead of IHttpActionResult
.
This solution worked for me:
Tools – > Library Package Manager -> Package Manager Console, then type:
Install-Package Microsoft.AspNet.WebApi -Version 5.0.0
update-Package Microsoft.AspNet.WebApi –reinstall
Reference: http://blog.bitlinkit.com/type-namespace-ihttpactionresult-not-found/