MvcContrib.FluentHtml.ModelWebViewPage 和 ASP.NET MVC4
只是想用 mvccontrib 来工作 mvc4 我在 web.config 中设置了基本页面(与我在 mvc3 项目中所做的方式相同)
<pages pageBaseType="MvcContrib.FluentHtml.ModelWebViewPage">
,但在运行时我收到一个错误:
Server Error in '/' Application.
--------------------------------------------------------------------------------
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: CS0305: Using the generic type 'MvcContrib.FluentHtml.ModelWebViewPage<T>' requires 1 type arguments
Source Error:
Line 32:
Line 33:
Line 34: public class _Page_Views_Home_Index_cshtml : MvcContrib.FluentHtml.ModelWebViewPage {
Line 35:
Line 36: #line hidden
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\17698293\b6166ab6\App_Web_index.cshtml.a8d08dba.e7moq-gi.0.cs Line: 34
可能有人可以帮助解决这个问题?有什么想法吗?
更新:
看起来问题是:
如果我设置自定义基类
并且如果视图没有任何自定义在这种情况下我会收到该错误。因此,在这种情况下,我只需将视图中的模型设置为@modeldynamic,它就会工作,然后再次失败,所以我只需将basePageType更改为默认值并使用MvcContrib.FluentHtml.ModelWebViewPage
,直到在下一个 MvcContrib/MVC 4
版本中修复。
Just trying to get work mvc4 with mvccontrib
I set base page in web.config (the same way i did in my mvc3 projects)
<pages pageBaseType="MvcContrib.FluentHtml.ModelWebViewPage">
But in run time i get an error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
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: CS0305: Using the generic type 'MvcContrib.FluentHtml.ModelWebViewPage<T>' requires 1 type arguments
Source Error:
Line 32:
Line 33:
Line 34: public class _Page_Views_Home_Index_cshtml : MvcContrib.FluentHtml.ModelWebViewPage {
Line 35:
Line 36: #line hidden
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\17698293\b6166ab6\App_Web_index.cshtml.a8d08dba.e7moq-gi.0.cs Line: 34
May be some one may help with that? Any thoughts?
UPDATE:
Looks like the problem is:
If i set custom base class <pages pageBaseType="MvcContrib.FluentHtml.ModelWebViewPage">
and if view does not have any custom model on it in such case i am getting that error. So in such case i just need to set model in the view to @model dynamic and it would work and than failed again, so i just change basePageType to its default and use MvcContrib.FluentHtml.ModelWebViewPage<dynamic> and MvcContrib.FluentHtml.ModelWebViewPage<MyModel>
until it will be fixed in the next MvcContrib/MVC 4
versions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是
MvcContrib.FluentHtml.ModelWebViewPage
不存在,只有MvcContrib.FluentHtml.ModelWebViewPage
。如果您没有模型类,则可以执行MvcContrib.FluentHtml.ModelWebViewPage
。话虽如此,我不知道 MVC Contrib 是否可以与 MVC4 一起使用,通常至少需要针对新的 MVC 版本重新编译内容。 。 。 。
The issue is
MvcContrib.FluentHtml.ModelWebViewPage
does not exist, there is onlyMvcContrib.FluentHtml.ModelWebViewPage<T>
. If you don't have a model class, you could doMvcContrib.FluentHtml.ModelWebViewPage<dynamic>
.All that said, I have no idea of MVC Contrib will work with MVC4, typically one needs to at least recompile things against the new MVC version . . . .