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

独自空忆成欢 提交于 2021-02-10 04:41:49

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/54086281/the-type-or-namespace-http-doesnt-exist-in-the-namespace-system-web-in-web

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!