为什么我的项目要寻找 System.Web.Razor?

时间:2021-06-15 14:30:24

标签: asp.net

我正在更新一个不使用 MVC 的 webforms 项目。我不确定它为什么要寻找 Razor。不应该。它在开发系统上运行良好,但在中间测试服务器上运行良好。

为什么会出现这个错误?感谢您的帮助。

无法加载文件或程序集“System.Web.Razor”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自 HRESULT 的异常:0x80131040) 说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误及其在代码中的来源的更多信息。

异常详细信息:System.IO.FileLoadException:无法加载文件或程序集“System.Web.Razor”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自 HRESULT 的异常:0x80131040)

源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常来源和位置的信息。

程序集加载跟踪:以下信息有助于确定无法加载程序集“System.Web.Razor”的原因。

警告:程序集绑定日志已关闭。 要启用程序集绑定失败日志记录,请将注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) 设置为 1。 注意:有一些与程序集绑定失败日志相关的性能损失。 要关闭此功能,请删除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

堆栈跟踪:

[FileLoadException: 无法加载文件或程序集“System.Web.Razor”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自 HRESULT 的异常:0x80131040)]

[FileLoadException:无法加载文件或程序集“System.Web.Razor,版本=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自 HRESULT 的异常:0x80131040)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean for Introspection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean for Introspection, Boolean SuppressSecurityChecks) +225 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean for Introspection) +110 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean for Introspection) +22 System.Reflection.Assembly.Load(String assemblyString) +34 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48

[ConfigurationErrorsException:无法加载文件或程序集“System.Web.Razor,版本=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自 HRESULT 的异常:0x80131040)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +725 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +247 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +157 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +226 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +73 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +319 System.Web.Compilation.BuildManager.ExecutePreAppStart() +170 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +820

[HttpException (0x80004005): 无法加载文件或程序集“System.Web.Razor,版本=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。 (来自 HRESULT 的异常:0x80131040)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

我没有任何对 System.Web.Mvc 的引用

Here are my references:

1 个答案:

答案 0 :(得分:0)

由梅森回答。只是搜索出现了错误的参考。谢谢!

相关问题