Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc Asp.NETMVC4网站在服务器上部署抛出错误“;无法加载类型';System.Web.WebPages.DisplayModes'&引用;_Asp.net Mvc_Visual Studio_Asp.net Mvc 4_Web Deployment - Fatal编程技术网

Asp.net mvc Asp.NETMVC4网站在服务器上部署抛出错误“;无法加载类型';System.Web.WebPages.DisplayModes'&引用;

Asp.net mvc Asp.NETMVC4网站在服务器上部署抛出错误“;无法加载类型';System.Web.WebPages.DisplayModes'&引用;,asp.net-mvc,visual-studio,asp.net-mvc-4,web-deployment,Asp.net Mvc,Visual Studio,Asp.net Mvc 4,Web Deployment,在过去的6个小时里,我一直在努力解决这个问题,但仍然无法解决这个问题。当我在服务器上部署一个Asp.NETMVC4项目时,我遇到了这个异常,该服务器是一个共享主机。我有这个问题 我摸索了一下,发现这可能与System.Web.Mvc和System.Web.WebPages的版本差异有关。我验证了所有DLL的版本号,尝试使用nuget重新安装,但仍然收到相同的消息 我认为这可能只是一个与我的项目有关的问题,于是创建了一个新的Asp.NETMVC4互联网应用程序,并将其部署在服务器上,boom。。。

在过去的6个小时里,我一直在努力解决这个问题,但仍然无法解决这个问题。当我在服务器上部署一个Asp.NETMVC4项目时,我遇到了这个异常,该服务器是一个共享主机。我有这个问题

我摸索了一下,发现这可能与System.Web.Mvc和System.Web.WebPages的版本差异有关。我验证了所有DLL的版本号,尝试使用nuget重新安装,但仍然收到相同的消息

我认为这可能只是一个与我的项目有关的问题,于是创建了一个新的Asp.NETMVC4互联网应用程序,并将其部署在服务器上,boom。。。我收到了同样的信息

在接下来的几个小时里,我卸载了所有旧版本的Asp.Mvc,修复了VisualStudio2010,使用Web平台安装程序再次安装了MVC4,但没有任何帮助,仍然收到了同样的信息

谁能帮帮我,我只是被卡住了

这是错误消息

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
无法从程序集'System.Web.WebPages,版本=2.0.0.0,区域性=中立,PublicKeyToken=31bf3856ad364e35'加载类型'System.Web.WebPages.DisplayModes'。
描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源。
异常详细信息:System.TypeLoadException:无法从程序集“System.Web.WebPages,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”加载类型“System.Web.WebPages.DisplayModes”。
源错误:
在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别。
堆栈跟踪:
[TypeLoadException:无法从程序集System.Web.WebPages、版本=2.0.0.0、区域性=中立、PublicKeyToken=31bf3856ad364e35加载类型'System.Web.WebPages.DisplayModes'
System.Web.Mvc.VirtualPathProviderViewEngine.GetPath(ControllerContext ControllerContext,String[]位置,String[]区域位置,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___显示类c.b___a(IViewEngine)+43
System.Web.Mvc.ViewEngineCollection.Find(Func`2查找,布尔跟踪搜索路径)+177
System.Web.Mvc.ViewEngineCollection.Find(Func`2缓存定位器,Func`2定位器)+23
System.Web.Mvc.ViewResult.FindView(ControllerContext上下文)+144
System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext上下文)+151
System.Web.Mvc.c__显示Class1C.b__19()+33
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter筛选器,ResultExecutingContext预文本,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)+335
System.Web.Mvc.c__显示类b.b__5()+62
System.Web.Mvc.Async.c__显示类1.b__0()+20
System.Web.Mvc.c_uuudisplayClasse.b_uuud()+54
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+469
System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值&同步完成)+375
版本信息:Microsoft.NET Framework版本:4.0.30319;ASP.NET版本:4.0.30319.272
以下是我在谷歌上搜索并找到的解决问题的链接:


解决办法并不那么清楚。不适用于我。

类似的问题已经被提出:我在项目中的任何地方都没有使用DisplayMode。即使部署默认的MVC4 Internet应用程序也会引发此异常,因此提出了这个问题。