我刚刚安装MVC2和我有看起来像这样的一个观点。
<%@页标题=LANGUAGE =C#的MasterPageFile =〜/查看/共享/ Home.Master继承=System.Web.Mvc.ViewPage %GT;< ASP:内容ID =内容1ContentPlaceHolderID =TitleContent=服务器> 家< / ASP:内容>< ASP:内容ID =内容2ContentPlaceHolderID =日程地址搜索Maincontent=服务器> < H2>家庭和LT; / H>< / ASP:内容>和所述控制器被刚刚返回图。但是,当我运行该页面我得到这个错误:
System.InvalidOperationException:在〜/查看/页/ home.aspx视图必须继承自ViewPage,的ViewPage,ViewUserControl或ViewUserControl派生
解决方案您可能会在无意中已加载到同一个应用程序的MVC框架的两个版本。为了证实,从下载MVC 2期货aspnet.$c$cplex/releases/view/41742.有这个ZIP文件的文件的 MvcDiagnostics.aspx
不要忘了从项目中删除MvcDiagnostics.aspx当您完成。
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: The view at '~/Views/Page/home.aspx' must derive from ViewPage, ViewPage, ViewUserControl, or ViewUserControl.
解决方案
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.
Don't forget to delete MvcDiagnostics.aspx from your project when you are done.
更多推荐
收到错误&QUOT;视图在“〜/查看/页/ home.aspx'必须自ViewPage,与的ViewPage LT获得; TViewData&gt;中V
发布评论