2011-10-07 60 views
0

我一直在尝试在运行ASP.NET MVC 1.0应用程序的服务器上部署ASP.NET 4.0(webform)项目的过程中网络的根。我正在慢慢地取得进展,但遇到了一堵墙,所以我决定重新编译MVC应用程序,使其与MVC框架的2.0版和.NET框架的4.0版重新编译。我使用了一些工具来做到这一点。从ASP.NET MVC 1.0迁移中断响应和请求对象

该项目似乎成功转换,但现在它无法编译。特别是,看起来System.Web.HttpContextBase存在问题。

举例来说,如果我有以下代码:

context.HttpContext.Response.Clear(); 

我得到以下错误:

'System.Web.HttpContextBase' does not contain a definition for 'Response' and no extension method 'Response' accepting a first argument of type 'System.Web.HttpContextBase' could be found (are you missing a using directive or an assembly reference?) 

我检查对象资源管理器,以确保公正:HttpContextBase确实有属性称为Response。这件事让我发疯。

我还有一个很大的问题,我认为这是相关的。任何时候Request对象查询:

Request["old"]; 

它说:

Cannot apply indexing with [] to an expression of type 'System.Web.HttpRequestBase' 

据我所知,没有任何理由无论是。

我在我的智慧结束。我已经检查了MVC 2.0的重大更改文档,但没有看到与此相关的任何内容。这些参考文献对我来说都很好,版本号全部检出。

有关服务器问题的其他说明:除ftp外,我没有任何对部署Web服务器的访问权限。我无法进入并且弄乱了服务器配置。这就是为什么你听起来有点奇怪。

+0

context.HttpContext'.Current.' Response.Clear答案();不是吗? – asawyer

+0

@asawyer不幸的是,没有。奇怪的是,虽然intellisense确实给了我说context.HttpContext.Response,context.HttpContext.Current根本不是一个选项。 – Josh

+0

我想知道IDE和运行时间是否不同意加载哪个版本的库。尝试创建一个新项目并将源代码移到它并编译? – asawyer

回答

1

我很高兴为你工作,在这里再次是为其他人

It's possible your IDE and Runtime are disagreeing over which library version to use. Try creating a new project and moving your source over to it and compiling again.