我尝试部署ASP.NET MVC 2项目(VS2010)赢得Server 2008 R2的
它完美地开发计算机上。但奇怪的错误发生在服务器2008 R2: 当.ascx文件有头使用泛型类型:
<%@控制语言=C#继承=System.Web.Mvc.ViewUserControl< MyProj.Web.Models.RangeViewModel>中%>
服务器报道未能加载类型System.Web.Mvc.ViewUserControl< MyProj.Web.Models.RangeViewModel>
。但是,当我宣布某处cs文件类型如
公共类AA:System.Web.Mvc.ViewUserControl< MyProj.Web.Models.RangeViewModel> { }和使用它来代替的<%@控的头。然后它的作品,因为它应该。
我缺少的东西?
更新
我部署两个步骤的应用程序(服务器):
我看的视图引擎在继承属性编译强类型的基类的问题。我有同样的问题和更新的web.config的页面部分到此帮助:
<网页 validateRequest =假 pageParserFilterType =System.Web.Mvc.ViewTypeParserFilter,System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35 pageBaseType =System.Web.Mvc.ViewPage,System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35 userControlBaseType =System.Web.Mvc.ViewUserControl,System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35> <控制> <添加组件=System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35命名空间=System.Web.Mvc标签preFIX =MVC/> < /控制> <! - 你的网页部分的休息 - > < /页>I'm trying to deploy ASP.NET MVC 2 project (VS2010) to Win Server 2008 R2
It works perfectly on dev machine. But strange error occurs at Server 2008 R2: When .ascx file has header that uses generic type:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>" %>Server reports Could not load type 'System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>'.
But when I declare somewhere in .cs file type like
public class AA : System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel> { }and use it instead in <%@ Control header. Then it works as it should.
Am I missing something?
UPDATE
I deploy app in two steps (on server):
解决方案
I looks that the view engine has problems compiling strongly typed base class in Inherit attribute. I had the same issue and updating the "pages" section of Web.Config to this helped:
<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <controls> <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" /> </controls> <!-- rest of your pages section --> </pages>
更多推荐
未能加载类型“System.Web.Mvc.ViewUserControl&LT; SOMETYPE&GT;”
发布评论