安装ASP.NET MVC 4 Beta后引发InvalidCastException

安装ASP.NET MVC 4 Beta后引发InvalidCastException,asp.net,asp.net-mvc,razor,asp.net-mvc-4,asp.net-webpages,Asp.net,Asp.net Mvc,Razor,Asp.net Mvc 4,Asp.net Webpages,在使用ASP.NET MVC 3的计算机上安装ASP.NET MVC 4 Beta后,我遇到以下异常 用户代码未处理System.InvalidCastException Message=[A]System.Web.WebPages.Razor.Configuration.HostSection无法强制转换 至[B]System.Web.WebPages.Razor.Configuration.HostSection。A型起源于 来自'System.Web.WebPages.Razor,版本=1

在使用ASP.NET MVC 3的计算机上安装ASP.NET MVC 4 Beta后,我遇到以下异常

用户代码未处理System.InvalidCastException Message=[A]System.Web.WebPages.Razor.Configuration.HostSection无法强制转换 至[B]System.Web.WebPages.Razor.Configuration.HostSection。A型起源于 来自'System.Web.WebPages.Razor,版本=1.0.0.0,文化=中性, PublicKeyToken=31bf3856ad364e35'位于位置处的上下文“默认值” 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_1.0.0_uuu31BF3856AD364E35\System.Web.WebPages.Razor.dll'。 类型B源自“System.Web.WebPages.Razor,版本=2.0.0.0,区域性=中性,PublicKeyToken=31bf3856ad364e35” 在“C:\Windows\Microsoft.Net\assembly\GAC\U MSIL\System.Web.WebPages.Razor\v4.0\U 2.0.0.0\UUU 31bf3856ad364e35\System.Web.WebPages.Razor.dll”位置的上下文“Default”中。 Source=System.Web.WebPages.Razor

堆栈跟踪:

位于System.Web.WebPages.Razor.WebRazorHostFactory.GetRazorSection(字符串virtualPath) 位于System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfig(字符串virtualPath,字符串physicalPath) 在System.Web.WebPages.Razor.RazorBuildProvider.GetHostFromConfig()中 在System.Web.WebPages.Razor.RazorBuildProvider.CreateHost()中 位于System.Web.WebPages.Razor.RazorBuildProvider.EnsureRegeneratedCode()中 在System.Web.WebPages.Razor.RazorBuildProvider.get_CodeCompilerType()中 位于System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider BuildProvider) 位于System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()处 在System.Web.Compilation.BuildProvidersCompiler.PerformBuild()中 位于System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath VirtualPath) 位于System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath、Boolean noBuild、Boolean allowCrossApp、Boolean allowBuildInPrecompile、Boolean throwIfNotFound、Boolean EnsureUpdate) 在System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext上下文、VirtualPath VirtualPath、Boolean noBuild、Boolean allowCrossApp、Boolean allowBuildInPrecompile、Boolean throwIfNotFound、Boolean EnsureUpdate) 位于System.Web.Compilation.BuildManager.GetVirtualPath对象工厂(VirtualPath VirtualPath、HttpContext上下文、布尔allowCrossApp、布尔throwIfNotFound) 位于System.Web.Mvc.buildmanagerRapper.System.Web.Mvc.IBuildManager.FileExists(字符串virtualPath) 位于System.Web.Mvc.BuildManagerViewEngine.FileExists(ControllerContext ControllerContext,字符串virtualPath) 位于System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext ControllerContext,列表'1位置,字符串名称,字符串控制器名称,字符串区域名称,字符串缓存键,字符串[]和搜索位置) 位于System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext ControllerContext,String[]位置,String[]区域位置,String locationsPropertyName,String name,String controllerName,String cacheKeyPrefix,Boolean useCache,String[]和searchedLocations) 位于System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext ControllerContext、String viewName、String masterName、Boolean useCache) 在System.Web.Mvc.ViewEngineCollection.c__显示classc.b__;b(IViewEngine) 在System.Web.Mvc.ViewEngineCollection.Find(Func`2查找,布尔跟踪搜索路径) 位于System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext ControllerContext,String viewName,String masterName) 位于System.Web.Mvc.ViewResult.FindView(ControllerContext上下文) 在System.Web.Mvc.ViewResultBase.ExecuteSult(ControllerContext上下文)中 位于System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext ControllerContext,ActionResult ActionResult) 在System.Web.Mvc.ControllerActionInvoker.c_uuDisplayClass1C.b_uuu19()中 位于System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter筛选器、ResultExecutingContext预文本、Func`1 continuation) 在System.Web.Mvc.ControllerActionInvoker.c_uudisplayClass1C.c_uuudisplayClass1E.b_uu1b()中 位于System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext ControllerContext,IList`1 filters,ActionResult ActionResult) 位于System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext ControllerContext,String actionName) 在System.Web.Mvc.Controller.ExecuteCore()上 在[file\u path]中的[project\u namespace].Controllers.GlobalizationController.ExecuteCore()处 在System.Web.Mvc.ControllerBase.Execute(RequestContext-RequestContext)中 位于System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext RequestContext) 在System.Web.Mvc.MvcHandler.c_uuudisplayClass6.c_uudisplayClassB.b_uu5()中 在System.Web.Mvc.Async.AsyncResultRapper.c__DisplayClass1.b__0()中 在System.Web.Mvc.Async.AsyncResultRapper.c_uuu显示类8`1.b_uuu7(IAsyncResult) 位于System.Web.Mvc.Async.AsyncResultRapper.WrappedAsyncResult`1.End() 在System.Web.Mvc.MvcHandler.c_udisplayClasse.b_ud()中 在System.Web.Mvc.SecurityUtil.b_0(操作f) 位于System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(操作) 位于System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) 在System.Web.Mvc.MvcHandler.System.Web.IHTTPassynchandler.EndProcessRequest中(IAsyncResult结果) 在System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()中 在System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)

这个集团
<appSettings>
  <add key="webpages:Version" value="1.0.0.0"/>
</appSettings>
<runtime><!-- Should be there by default, near end -->
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><!-- Should be there by default -->
    <dependentAssembly>..</dependentAssembly><!-- Should be there by default -->
        ... some other dependecy redirects ...

    <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor"
            publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
    </dependentAssembly>

        ... some other dependency redirects ...
    </assemblyBinding>
</runtime>
<appSettings>
    <add key="webpages:Enabled" value="false" />
</appSettings>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
  <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
  <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>