我已经将一个使用 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.Cors
和 Microsoft.AspNet.WebApi.Cors
。
关于c# - 我的机器上无法识别 Web API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28265146/