在装有ASP.NET MVC 3的计算机上安装ASP.NET MVC 4 Beta后,出现以下异常。
用户代码Message = [A] System.Web.WebPages.Razor.Configuration.HostSection无法处理System.InvalidCastException,无法将其强制转换为[B] System.Web.WebPages.Razor.Configuration.HostSection。类型A源自'System.Web.WebPages.Razor,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'在上下文'Default'中的位置'C:\ Windows \ Microsoft.Net \ assembly \ GAC_MSIL \ System .Web.WebPages.Razor \ v4.0_1.0.0.0__31bf3856ad364e35 \ System.Web.WebPages.Razor.dll'。类型B源自位置'C:\ Windows \ Microsoft.Net \ assembly \ GAC_MSIL \ System的上下文'Default'中的'System.Web.WebPages.Razor,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35' .Web.WebPages.Razor \ v4.0_2.0.0。0__31bf3856ad364e35 \ System.Web.WebPages.Razor.dll'。源= System.Web.WebPages.Razor
堆栈跟踪:
在System.Web.WebPages.Razor.WebRazorHostFactory.CreateHostFromConfig(String virtualPath,String physicalPath)在System.Web.WebPages.Razor.RazorBuildProvider.GetHostFromConfig()在System.Web.WebPages.Razor.WebRazorHostFactory.GetRazorSection(String virtualPath) System.Web.WebPages.Razor.RazorBuildProvider.EnsureGeneratedCode()处于System.Web.WebPages.Razor.RazorBuildProvider.get_CodeCompilerType()处于System.Web.Compilation.BuildProvider处的System.Web.WebPages.Razor.RazorBuildProvider.CreateHost()。 System.Web.Compilation.BuildProviders的System.Web.Compilation.BuildProvidersCompiler.PerformBuild()的System.Web.Compilation.BuildProviders的GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)。System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(VirtualPath virtualPath,布尔值noBuild,布尔值allowCrossApp,布尔值allowBuildInPrecompile,布尔throwIfNotFound,布尔数确保IsUpToDate) ,System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath,HttpContext上下文,布尔型allowCrossApp,布尔型IfIfNotFound)在System.Web.Mvc.BuildManagerWrapper。 System.Web.Mvc.BuildManagerViewEngine上的Web.Mvc.IBuildManager.FileExists(String virtualPath)。System.Web上System.Web.Mvc.VirtualPathProviderViewEngine.GetPathFromGeneralName(ControllerContext controllerContext,List`1的位置,字符串名称,字符串controllerName,字符串areaName,字符串cacheKey,字符串[]&searchedLocations)的FileExists(ControllerContext controllerContext,String virtualPath)。 Mvc.VirtualPathProviderViewEngine.GetPath(System.Web.Mvc.VirtualPathProviderViewEngine.FindView上的ControllerContext controllerContext,String [] location,String [] areaLocations,String locationPropertyName,String name,String controllerName,String cacheKeyPrefix,布尔useCache,String []&searchedLocations)。 (ControllerContext controllerContext,String viewName,String masterName,Boolean useCache)位于System.Web.Mvc.ViewEngineCollection。<> c__DisplayClassc。System.Web.Mvc.ViewEngineCollection.Find上的b__b(IViewEngine e)(System.Web.Mvc.ViewEngineCollection.FindView(Func`2 lookup,Boolean trackSearchedPaths)在System.Web.Mvc上的System.Web.Mvc.ViewEngineCollection.FindView(ControllerContext controllerContext,String viewName,String masterName) System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext上下文)在System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext,ActionResult actionResult)在System.Web.Mvc.ControllerActionInvoker。<> System.Web.Mvc.ControllerActionInvoker上的c__DisplayClass1c.b__19()在System.Web.Mvc.ControllerActionInvoker.I>上的c__DisplayClass1c.b__19()在System.Web.Mvc.ControllerActionInvoker。<> c__DisplayClass1c。<System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext,IList`1过滤器,ActionResult actionResult)在System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,String actionName)在System.Web处> c__DisplayClass1e.b__1b()。在System.Web.Mvc.ControllerBase.System.Web的System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)在[文件路径]的[project_namespace]中的Mvc.Controller.ExecuteCore()。 System.Web.Mvc.MvcHandler上的Mvc.IController.Execute(RequestContext requestContext).System的System.Web.Mvc.Async.AsyncResultWrapper上的<> c__DisplayClass6。<> c__DisplayClassb.b__5()。System上的c >> ____ DisplayClass1.b__0()。 Web.Mvc。Async.AsyncResultWrapper。<> c.DisplayClass8`1.b__7(IAsyncResult _)在System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()在System.Web.Mvc.MvcHandler。<> c__DisplayClasse.b__d()在System.Web.Mvc.SecurityUtil.b__0(Action f)在System.Web.Mvc.MvcHandler.System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)处System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)。位于System.Web.HttpApplication.ExecuteStep处的System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult结果)(位于System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔且已完成)处的System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()System.Web.Mvc.MvcHandler上的Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()。System.Web上System.Web.Mvc.SecurityUtil.b__0(动作f)处的<> c__DisplayClasse.b__d()。 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)处的System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult结果)处的Mvc.SecurityUtil.ProcessInApplicationTrust(Action操作) System.Web.HttpApplication.ExecuteStep处的CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()(IExecutionStep步骤,布尔值和完成同步)System.Web.Mvc.MvcHandler的Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()。System.Web的System.Web.Mvc.SecurityUtil.b__0(动作f)处的<> c__DisplayClasse.b__d()。 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)处的System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult结果)处的Mvc.SecurityUtil.ProcessInApplicationTrust(Action操作) System.Web.HttpApplication.ExecuteStep处的CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()(IExecutionStep步骤,布尔值和完成同步)System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)的System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action动作)的b__0(Action f)System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest( IAsyncResult结果)位于System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()位于System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔且已完成)System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)的System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action动作)的b__0(Action f)System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest( IAsyncResult结果)位于System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()位于System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔且已完成)System.Web.HttpApplication.ExecuteStep上的HttpApplication.IExecutionStep.Execute()(IExecutionStep步骤,布尔值和完成同步)System.Web.HttpApplication.ExecuteStep上的HttpApplication.IExecutionStep.Execute()(IExecutionStep步骤,布尔值和完成同步)
这完全阻止了我,并且尽管我想保留beta,但为了摆脱异常,可能需要将其完全删除。