Asp.net mvc 编译错误-MVC

Asp.net mvc 编译错误-MVC,asp.net-mvc,compilation,Asp.net Mvc,Compilation,我尝试在MVC中将aspx重新编程为cshtml,错误显示为: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. C

我尝试在MVC中将aspx重新编程为cshtml,错误显示为:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS0115: 'ASP._Page_Views_User_Index_cshtml.Execute()': no suitable method found to override

Source Error:


Line 59:         }
Line 60:         
Line 61:         public override void Execute() {
Line 62: BeginContext("~/Views/User/Index.cshtml", 80, 14, false);
Line 63: 

我不知道这是什么错误。。。任何想法…

这是视图中的语法错误~/Views/User/Index.cshtml。它是在运行时编译的,因此不会在构建时引发错误。仔细检查视图,看看是否有红色的内容。我感觉您试图使用mvc视图作为webforms代码隐藏。在razor视图中,您不能定义方法或类