MvcContrib.FluentHtml.ModelWebViewPage 和 ASP.NET MVC4

发布于 2024-12-16 11:56:30 字数 1487 浏览 0 评论 0原文

只是想用 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.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

時窥 2024-12-23 11:56:30

问题是 MvcContrib.FluentHtml.ModelWebViewPage 不存在,只有 MvcContrib.FluentHtml.ModelWebViewPage。如果您没有模型类,则可以执行 MvcContrib.FluentHtml.ModelWebViewPage

话虽如此,我不知道 MVC Contrib 是否可以与 MVC4 一起使用,通常至少需要针对新的 MVC 版本重新编译内容。 。 。 。

The issue is MvcContrib.FluentHtml.ModelWebViewPage does not exist, there is only MvcContrib.FluentHtml.ModelWebViewPage<T>. If you don't have a model class, you could do MvcContrib.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 . . . .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文