当前位置: 首页 > 知识库问答 >
问题:

无法加载文件或程序集“System.Web.MVC”。如何使用正确的参照物?

钱经赋
2023-03-14
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="NLog" publicKeyToken="5120e14c03d0593c" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.1.0" newVersion="2.0.1.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="AntiXssLibrary" publicKeyToken="d127efab8a9c114f" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>
  <!--<dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
  </dependentAssembly>-->
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>
</assemblyBinding>

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

[FileLoadException:无法加载文件或程序集“System.web.mvc,version=5.2.3.0,Culture=Neutral,PublicKeyToken=31BF3856AD364E35”或其依赖项之一。所找到的程序集的清单定义与程序集引用不匹配。(来自HRESULT的异常:0x80131040)]System.Reflection.RuntimeAssembly._nLoad(AssemblyName文件名、字符串代码库、证据assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&system.reflection.RuntimeAssembly.nload(AssemblyName文件名、字符串代码库、证据assemblySecurity、RuntimeAssembly locationHint、StackCrawlMark&stackMark、IntPtr pPrivHostBinder、Boolean throwOnFileNotFound、Boolean forIntrospection、Boolean suppressSecurityChecks)+36
System.Reflection.RuntimeAssemblyName(AssemblyNamelmark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forinspection,Boolean suppressSecurityChecks)+152
System.reflection.runtimeAssembly.InternalLoad(String assemblyString,证据assemblySecurity,StackCrawlMark&stackMark,intpr pPrivHostBinder,Boolean forinspection,StrakCrawlMark,Boolean Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)+38

[ConfigurationErrorsException:无法加载文件或程序集“System.Web.MVC,Version=5.2.3.0,Culture=Neutrine,publickeyToken=31BF3856AD364E35”或其依赖项之一。所找到的程序集的清单定义与程序集引用不匹配。(来自HRESULT的异常:0x80131040)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean Startirective)+738>system.web.compilation.buildmanager.GetReferencedAssemblies(CompilationSection Componfig)+170
System.web.compilation.BuildManager.GetPreStartinitMethodsFromReferencedAssemblies()+92 System.web.compilation.BuildManager.CallPreStartinitMethods(String preStartInitListPath,Boolean&IsRefAssemblyLoad)+290Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel PolicyLevel,Exception appDomainCreationException)+531

[HttpException(0x80004005):无法加载文件或程序集“System.Web.MVC,Version=5.2.3.0,Culture=Neutrative,PublicKeyToken=31BF3856AD364E35”或其依赖项之一。所找到的程序集的清单定义与程序集引用不匹配。(来自HRESULT的异常:0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+9924184 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)

如何升级System.Web.MVC的版本以指向正确的程序集?

共有1个答案

秦晋
2023-03-14

由于绑定不正确导致错误。我变了:

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>

  <dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.0.0.0" />

现在起作用了。

 类似资料:
  • 我试图托管一个webproject,但是当服务器试图编译它时,我得到以下错误: 未处理的异常:System.io.FileLoadException:无法加载文件或程序集“Microsoft.codeAnalysis,版本=1.1.1.0,Culture=Neutrice,PublicKeyToken=31BF3856AD364E35”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。(来

  • 我尝试将两个 ASP.NET Web 项目(一个 Facebook 应用程序和一个机器人)部署到同一个 Azure 网站,但在我部署了它们之后,我收到了: 无法加载文件或程序集“System.Web”。Mvc’或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(HRESULT异常:0x80131040) 我不确定我能做什么,除了从头开始并将两个项目合并成一个项目(不可取)重新发布。到目前为

  • 我在我的项目中使用的是umbraco 4.11.3。我的项目在Windows 7上运行良好,并在visual studio 2012上运行。但它在Win 8中从visual studio 2012运行时并不工作! 错误是: 无法加载文件或程序集“System.Web”。Mvc,Version=2.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e

  • 对于可以与Azure函数一起使用的包是否有任何限制。我已经尽可能多地研究了,但似乎并不是这样,然而,当我试图创建一个引用包“Microsoft.ServiceFabric”的Azure函数时,我得到了以下错误: corelib:执行函数时异常:ScaledOwnServiceFabrics。FunctionApp2:无法加载文件或程序集“System.Fabric,版本=6.0.0.0,Cultu

  • 问题内容: 我正在尝试将CS​​V文件加载到AngularJS中,以便可以对内容进行一些操作。它不是我想要的那样工作。为了测试它是否正确加载,我将其加载到文本区域中以查看内容。 当我加载文件时,它说它已正确加载,但在加载第二个CSV文件之前似乎没有触发onload()事件,在这种情况下,FIRST文件显示在文本区域中。 HTML: JS: 当我将其放入JSFiddle时,该文件根本不会出现在tex