Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web API cannot resolve symbol Http in System.Web.Http, what is missing?

I have a webforms project.
I use nuget to install web API by running Install-Package WebApi.All
I create a class

public class CartController : System.Web.Http.ApiController

but it cannot resolve symbol Http in System.Web.Http, what dependency am I missing?

like image 714
Myster Avatar asked Apr 11 '12 22:04

Myster


People also ask

Which of the following is the namespace for IHttpActionResult return type in Web API?

The IHttpActionResult interface is contained in the System. Web. Http namespace and creates an instance of HttpResponseMessage asynchronously.

What is Apicontroller C#?

Web API Controller is similar to ASP.NET MVC controller. It handles incoming HTTP requests and send response back to the caller. Web API controller is a class which can be created under the Controllers folder or any other folder under your project's root folder.


1 Answers

The name of the package for the ASP.NET Web API isn't "WebApi.All". The package for the ASP.NET Web API (Beta) is "AspNetWebApi". Try running the following instead:

Install-Package AspNetWebApi
like image 156
carlosfigueira Avatar answered Nov 05 '22 07:11

carlosfigueira