我在过去6个小时内一直在努力解决这个问题,但仍无法解决这个问题。当我在服务器上部署一个Asp.Net Mvc 4项目时,我得到了这个例外,这是一个共享主机。我遇到了这个问题。
我googled并发现它可能是与System.Web.Mvc和System.Web.WebPages的版本差异相关的问题。我验证了所有dll的版本号,尝试使用nuget重新安装,但仍然收到相同的消息。
认为这可能只是与我的项目有关的问题,我创建了一个新的Asp.Net Mvc 4 Internet应用程序并将其部署在服务器上,繁荣......得到了相同的消息。
我花了几个小时卸载所有旧版本的Asp.Mvc,修复Visual Studio 2010,再次使用Web Platform Installer安装Mvc 4,但没有任何帮助,仍然得到相同的消息。
任何人都可以帮忙,我只是被卡住了。
以下是错误消息
Could not load type 'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[TypeLoadException: Could not load type 'System.Web.WebPages.DisplayModes' from assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext controllerContext, String[] locations, String[] areaLocations, String locationsPropertyName, String name, String controllerName, String cacheKeyPrefix, Boolean useCache, String[]& searchedLocations) +0
System.Web.Mvc.VirtualPathProviderViewEngine.FindView(ControllerContext controllerContext, String viewName, String masterName, Boolean useCache) +198
System.Web.Mvc.<>c__DisplayClassc.<FindView>b__a(IViewEngine e) +43
System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths) +177
System.Web.Mvc.ViewEngineCollection.Find(Func`2 cacheLocator, Func`2 locator) +23
System.Web.Mvc.ViewResult.FindView(ControllerContext context) +144
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +151
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +846308
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +846608
System.Web.Mvc.Controller.ExecuteCore() +159
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +335
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +62
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +20
System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +469
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +375
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
以下是我用Google搜索并找到解决问题的链接:
http://tkntips.blogspot.in/2012/05/could-not-load-type-systemwebwebpagesdi.html
解决方案不是那么清楚。不适合我。