【发布时间】:2012-08-25 11:09:32
【问题描述】:
我不久前安装了 asp.net mvc-4 beta 来托管我们的 api。在我刚刚在我的机器上安装了 vs2012 Ultimate 之前它运行良好。该项目既不在 vs2010 也不在 vs2012 中编译。我能做些什么来解决这个冲突。此外,我在我的服务器上部署了 asp.net web api 程序集。我必须做什么才能在服务器上运行最新版本(一旦前面的问题得到解决)?
编辑:
我在 vs2012 中打开时的编译错误是
'System.Net.Http.HttpRequestMessage' does not contain a definition for 'GetUserPrincipal' and no extension method 'GetUserPrincipal'...
'System.Web.Http.Hosting.HttpPropertyKeys' does not contain a definition for 'UserPrincipalKey'
另一方面,在 vs 2010 中,它拒绝接受 DelegatingHandler 等类型。一些错误如下。
The type or namespace name 'DelegatingHandler' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'HttpResponseMessage' could not be found (are you missing a using directive or an assembly reference?)
我也安装了最新版本的 asp.net mvc 4,它显示的版本是 4.0.20713.0。以前,我使用 nuget 添加了 web-api beta。我已将它们全部删除并从 nuget 安装了最新版本的 web-api。我不知道可能是什么问题。一件事,我不明白:为什么我需要单独安装 web-api 程序集,因为它们应该是 mvc 框架的一部分? 谢谢
【问题讨论】:
-
编译器错误会很有用。要更新您的 web api 箱,只需使用 nuget 并将您当前的箱替换为 RTM 版本或夜间构建。
-
第一个错误是找不到类型或命名空间
FormatterContext。HttpRepsonseMessage和HttpRequestMessage也是如此 -
我的编译没有问题,但 Intellisense 一直强调它说它不存在。不知道是怎么回事。
标签: asp.net-mvc-4 asp.net-web-api visual-studio-2012