我在下面的贾斯汀斯莱特里的插件架构教程并努力适应它的剃须刀,而不是WebForm的意见。
I'm following Justin Slattery's Plugin Architecture tutorial and trying to adapt it for Razor, instead of WebForm Views.
其他一切(控制器,插件程序集加载等)似乎是好的。不过,我没能获得嵌入式剃刀意见才能正常工作。当我尝试浏览到的HelloWorld /索引,我得到以下错误:
Everything else (controllers, plugin assembly loading, etc) seems to be okay. However, I'm not able to get embedded Razor views to work properly. When I try to browse to the "HelloWorld/Index", I get the following error:
在〜/插件/ MyProjectPlugin.dll / MyProjectPlugin.Views.HelloWorld.Index.cshtml的观点必须得到来自WebiewPage或WebViewPage。
The view at '~/Plugins/MyProjectPlugin.dll/MyProjectPlugin.Views.HelloWorld.Index.cshtml' must derive from WebiewPage or WebViewPage.
该异常是由 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext,TextWriter的作家,对象实例)262
我可以包括完整的堆栈跟踪,如果需要的话。
I can include the complete stack trace, if needed.
任何人都可以提出建议,以什么我可能做错了吗?
Can anyone advise as to what I might be doing wrong?
推荐答案您可以检出following博客文章它更适应剃刀。
You may checkout the following blog post which is more adapted to Razor.
但是,为了回答你的问题,因为你现在正在从一个非标准的位置服务的意见也不再是适用〜/查看/ web.config中文件允许你指定你的剃须刀意见的基本类型。所以,你可能需要添加每个剃刀视图顶部以下内容:
But to answer your question, since you are now serving your views from a non standard location there is no longer the ~/Views/web.config file that applies and allows you to specify the base type for your razor views. So you might need to add the following on the top of each razor view:
@inherits System.Web.Mvc.WebViewPage @model ...更多推荐
该视图必须从WebViewPage,或WebViewPage&LT获得;的TModel取代。
发布评论