c# - 我的机器上无法识别 Web API

标签 c# .net asp.net-mvc asp.net-web-api

我已经将一个使用 Web API 的项目下载到我的机器上。当我查看 nugget 窗口时,它显示我有 web api 2.2、Web 主机、核心库、客户端库、跨源支持和 Data v 1-3.

但是,当我尝试构建项目时,出现以下错误:

The type or namespace name 'Cors' does not exist in the namespace 'System.Web.Http' (are you missing an assembly reference?) and

The type or namespace name 'HttpApplication' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

如果你们能提供任何帮助,我们将不胜感激。

最佳答案

在我让 Resharper 添加 CORS 引用后,我遇到了同样的问题。

我通过添加正确的 nuget 包修复了它:Microsoft.AspNet.CorsMicrosoft.AspNet.WebApi.Cors

关于c# - 我的机器上无法识别 Web API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28265146/

相关文章:

c# - 通过匿名传递列名对通用列表的一列求和

c# - setter 和支持字段中的 .NET 逻辑

c# - 如何解密 key

c# - 在 DropDownListFor 上添加搜索功能

c# - 取消同步语音识别

c# - WinForm 应用程序的 MVVM 实现

c# - 通过电子邮件发送至 WorkItem - EWS 2007_SP1 和 TFS 2010

c# - 如何安全有效地缓存ADO.NET命令?

jquery - 是否有在 JavaScript 函数中使用 HtmlHelper 的正确方法?

c# - 在 asp.net Web api 应用程序中自定义 System.Web.Http.AuthorizeAttribute