7

I'm trying to create a Web API following this link . I have exactly added the way it is shown in this article.

But after adding the controller, it is giving me this error for System.Web.Http and ApiController.

Error message on System.Web.Http :

The type or namespace Http doesn't exist in the namespace 'System.Web'

Error message on ApiController:

The type or namespace ApiController could not be found.

Additional Information :

I'm using Visual Studio 2015 Professional. Framework : .NET Framework 4.6.1

I have searched a lot about this issue but couldn't find anything solution.I'm sure i'm missing very small details somewhere but can anyone help me here.
Thanks a lot in advance.

5
  • did you add the system.web library as a reference in your project? Commented Jan 8, 2019 at 6:28
  • check if System.Web and System.Web.Http is present in references. Did you select web api project at the time of project creation? Commented Jan 8, 2019 at 6:36
  • I have System.Web in the references list. But System.Web.Http is with a warning (yellow) symbol. So I'm guessing it is not able load. Commented Jan 8, 2019 at 6:41
  • Also , I tried to search System.Web.Http in the references window. I couldn't find it. Commented Jan 8, 2019 at 6:44
  • @t-prisar , I have selected Empty Template. Then in 'Add Folders and Core references' I checked Web API Commented Jan 8, 2019 at 6:48

1 Answer 1

23

It turns out that to get System.Web.Http, I need to install package - Microsoft.AspNet.WebApi.Core from Nuget. After installing, it solved my problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.