Web API的名称空间"System.Web"中不存在类型或名称空间"Http" [英] The type or namespace 'Http' doesn't exist in the namespace 'System.Web' in Web API

查看:76
本文介绍了Web API的名称空间"System.Web"中不存在类型或名称空间"Http"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试在此链接之后创建一个Web API.我已经完全添加了这篇文章中显示的方式.

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

但是添加控制器后,它给我 System.Web.Http ApiController 的错误.

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

System.Web.Http上的错误消息:

Error message on System.Web.Http :

类型或名称空间Http在名称空间'System.Web'中不存在

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

关于ApiController的错误消息:

Error message on ApiController:

找不到类型或名称空间ApiController.

The type or namespace ApiController could not be found.

其他信息:

我正在使用Visual Studio 2015专业版.框架:.NET Framework 4.6.1

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.

推荐答案

事实证明,要获取System.Web.Http,我需要从安装安装包- Microsoft.AspNet.WebApi.Core 努吉特安装后,它解决了我的问题.

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.

这篇关于Web API的名称空间"System.Web"中不存在类型或名称空间"Http"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆