c# - 错误:部署到 IIS 后无法加载文件或程序集 'System.Web.WebPages.Razor,版本 = 3.0.0.0
问题描述
我将我的代码部署到服务器并且我遇到了错误
Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
堆栈跟踪:
[FileLoadException: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.Mvc.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +646
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +147
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +107
System.Web.Compilation.BuildManager.ExecutePreAppStart() +165
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +590
[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10080656
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +263
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0
知道如何解决这个错误。请帮忙 。
解决方案
推荐阅读
- reactjs - 如何将 promise 转换为它所持有的数组?
- javascript - 为什么这个 NodeJS 掷骰子代码这么慢?
- haskell - Haskell - 无法运行简单的程序
- java - Spark - Java - 无法获取数组的 JDBC 类型
插入 Oracle Array 列类型时 - tailwind-css - 我如何用顺风来装饰背景
- c++ - 订购k个有序链表?
- android - tored 首选项在 StringRequest 中不起作用,但在 StringRequest 中是可以的——Android Kotlin
- python-3.x - Python pygame混音器音乐检测是否结束
- linux - 如何使用 perf(或任何其他工具)找出应用程序函数的执行时间
- cherrypy - cherrypy 页面处理程序返回包含字符串和字节对象的组合响应