我刚刚安装了MVC2,并且具有这样的视图
I've just installed MVC2 and I've got a view that looks like this
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Home.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Home </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>Home</h2> </asp:Content>并且控制器只是返回视图.但是,当我运行页面时,出现此错误:
And the controller is just returning the view. But when I run the page I get this error:
System.InvalidOperationException:〜/Views/Page/home.aspx"上的视图必须派生自ViewPage,ViewPage,ViewUserControl或ViewUserControl.
System.InvalidOperationException: The view at '~/Views/Page/home.aspx' must derive from ViewPage, ViewPage, ViewUserControl, or ViewUserControl.
推荐答案
您可能无意中将两个版本的MVC框架加载到同一应用程序中.要确认,请从 aspnet.codeplex/releases/view/41742下载MVC 2期货. .此ZIP文件中有一个文件 MvcDiagnostics.aspx .
You might unintentionally have two versions of the MVC framework loaded into the same application. To confirm, download MVC 2 Futures from aspnet.codeplex/releases/view/41742. There is a file MvcDiagnostics.aspx in this ZIP file.
完成后,请不要忘记从项目中删除MvcDiagnostics.aspx.
Don't forget to delete MvcDiagnostics.aspx from your project when you are done.
更多推荐
错误“位于“〜/Views/Page/home.aspx"的视图必须派生自ViewPage,ViewPage< TViewData&am
发布评论