Web API 在我的机器上无法识别

Web API not being recognized on my machine

我已经将一个项目下载到我使用 Web 的机器上 API。当我查看 nugget window 时,它显示我有 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