【发布时间】:2012-08-16 04:40:06
【问题描述】:
我已经安装了 MVC4 和我现在拥有的 MVC3 应用程序给我带来了问题。我得到错误:
无法加载文件或程序集“System.Web.WebPages,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配
但是,我在我的代码中找不到任何对 WebPages v2 的引用,我想知道为什么会出现此错误。有人可以帮忙吗?
编辑:这是完整的堆栈跟踪:
[FileLoadException: 无法加载文件或程序集 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (来自 HRESULT 的异常:0x80131040)]
C:\Users\M\Desktop\Development\ASP.NET 项目\ljMVC\ljMVC\ljMVC\Helpers\EditableHelpers 中的 ljMVC.Helpers.EditableHelpers.Editable(HtmlHelper 助手,字符串 htmlElement,字符串 cssId,字符串 defaultContent,对象 htmlAttributes)。 CS:90
ASP._Page_Areas_Gameplan_Views_MainGP_Index_cshtml.Execute() 在 e:\web\lovelyjubbl\htdocs\Areas\Gameplan\Views\MainGP\Index.cshtml:85
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +208
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +89
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +199
System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext 上下文)+291
System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.c_DisplayClass1c.b_19() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter 过滤器,ResultExecutingContext preContext,Func1 continuation) +264
System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList1 过滤器,ActionResult actionResult)+176
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +329
System.Web.Mvc.Controller.ExecuteCore() +115
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.c_DisplayClassb.b_5() +37
System.Web.Mvc.Async.c_DisplayClass1.b_0() +21
System.Web.Mvc.Async.c_DisplayClass81.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult1.End() +55
System.Web.Mvc.c_DisplayClasse.b_d() +31
System.Web.Mvc.SecurityUtil.b_0(动作 f)+7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(动作动作)+23
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult 结果) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
【问题讨论】:
-
请发布完整的异常堆栈跟踪。包含
calling assembly的部分特别有趣,因为它会告诉您哪个程序集正在尝试加载此程序集。而且您一定对这个 ASP.NET MVC 3 应用程序做了一些事情。它是什么?仅安装 ASP.NET MVC 4 不会对现有应用程序产生任何影响。我相信你已经修改了一些东西。就像在这个 MVC 3 应用程序中安装/更新 NuGet 或其他东西一样。它只是不会自行破裂。我有无数的 MVC 3 应用程序,安装 MVC 4 后,它们都可以继续工作。
标签: asp.net-mvc-3 asp.net-mvc-4