简体   繁体   English

找不到包含文档的“无法加载文件或程序集'System.Web.Mvc'或其依赖项之一”

[英]Can't resolve “Could not load file or assembly 'System.Web.Mvc' or one of its dependencies” with documentation found

I tried to deploy two ASP.NET web projects (a Facebook app and a bot) to the same Azure web site but, after I got them both deployed I received: 我尝试将两个ASP.NET Web项目(一个Facebook应用程序和一个bot)部署到同一Azure网站,但是在将它们都部署后,我收到了:

Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. 无法加载文件或程序集'System.Web.Mvc'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) (来自HRESULT的异常:0x80131040)

I'm not sure what I can do other than start all over and merge the two projects into a single project (not desirable) to republish. 除了从头开始并将两个项目合并为一个项目(不希望重新发布)之外,我不确定我还能做什么。 So far I've: 到目前为止,我已经:

  1. Installed, via NuGet, Microsoft.AspNet.Mvc as suggested in other threads. 根据其他线程的建议,通过NuGet安装了Microsoft.AspNet.Mvc。 Both projects have versions 5.2.3.0 on them 这两个项目的版本均为5.2.3.0
  2. Ensured the Web.config files have 5.2.3.0 on them 确保Web.config文件上具有5.2.3.0

Bot 博特

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>

App 应用

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
  </dependentAssembly>
  1. Ensured property "Copy Local" is set to "True" on both projects for reference System.Web.Mvc 在两个项目上确保将属性“ Copy Local”设置为“ True”以供参考System.Web.Mvc

Here's the stack trace: 这是堆栈跟踪:

[FileLoadException: Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. [FileLoadException:无法加载文件或程序集'System.Web.Mvc'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040)] (来自HRESULT的异常:0x80131040)

[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. [FileLoadException:无法加载文件或程序集'System.Web.Mvc,版本= 5.2.3.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 (来自HRESULT的异常:0x80131040)System.Reflection.RuntimeAssembly._nLoad(AssemblyName文件名,字符串codeBase,证据AssemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔throwOnFileNotFound,布尔值用于Introspection,布尔值抑制0)
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36 System.Reflection.RuntimeAssembly.nLoad(AssemblyName文件名,字符串codeBase,证据程序集安全性,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔值throwOnFileNotFound,布尔值用于自省,布尔值抑制安全性检查)+36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,证据assemblySecurity,RuntimeAssembly reqAssembly,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔型throwOnFileNotFound,布尔型用于自省,布尔型抑制安全检查)+152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77 System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据AssemblySecurity,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,用于自省的布尔值)+77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21 System.Reflection.Assembly.Load(String assemblyString) +28 System.Reflection.RuntimeAssembly.InternalLoad(字符串assemblyString,证据AssemblySecurity,StackCrawlMark&stackMark,用于自省的布尔值)+21 System.Reflection.Assembly.Load(字符串assemblyString)+28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,布尔型starDirective)+38

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. [ConfigurationErrorsException:无法加载文件或程序集'System.Web.Mvc,版本= 5.2.3.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040)] (来自HRESULT的异常:0x80131040)
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(字符串assemblyName,布尔型starDirective)+738
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()+217 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)+130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)+170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()+92 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath,Boolean&isRefAssemblyLoaded)+290
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157 System.Web.Compilation.BuildManager.ExecutePreAppStart()+157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +549 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParametershostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)+549

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. [HttpException(0x80004005):无法加载文件或程序集'System.Web.Mvc,版本= 5.2.3.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040)] (来自HRESULT的异常:0x80131040)
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10044576 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+10044576 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)+95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)+254

Please try going to https://[YourSiteName].scm.azurewebsites.net/DebugConsole/?shell=powershell 请尝试转到https:// [YourSiteName] .scm.azurewebsites.net / DebugConsole /?shell = powershell

And execute the following @ the PowerShell prompt: 并执行以下@ PowerShell提示符:

[System.Diagnostics.FileVersionInfo]::GetVersionInfo("d:\home\site\wwwroot\bin\System.Web.Mvc.dll").FileVersion

This will tell you what version the .Mvc.dll is. 这将告诉您.Mvc.dll是什么版本。

Note: your live site files are under \\site\\wwwroot\\ 注意:您的实时站点文件位于\\ site \\ wwwroot \\下

I resolved to start my web projects from scratch and see if I could solve this error. 我决心从头开始我的Web项目,看看是否可以解决此错误。 I was able to find this other answer on how to deploy two projects to a single Azure web site. 我能够找到有关如何将两个项目部署到单个Azure网站的其他答案 The idea is to create a virtual directory under the main web site and publish your web site to the root web site and, in my case the bot, to the virtual directory. 这个想法是在主网站下创建一个虚拟目录,并将您的网站发布到根网站,在我的例子中是bot,发布到虚拟目录。 So far it seems to hold! 到目前为止,它似乎成立了!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集&#39;System.Web.Mvc(1)&#39;或其依赖项之一 - Could not load file or assembly 'System.Web.Mvc(1)' or one of its dependencies 无法加载文件或程序集 System.Web.Mvc 或其依赖项之一 - Could not load file or assembly System.Web.Mvc or one of its dependencies 无法加载文件或程序集“System.Web.Mvc,Version = 3.0.0.0”或其依赖项之一 - Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0' or one of its dependencies 无法加载文件或程序集“System.Web.Mvc”或其依赖项之一。 定位的程序集的清单定义与程序集不匹配 - Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly 无法加载文件或程序集&#39;System.Web.Mvc&#39;或其依赖项之一。 2个项目。 一次只能工作一个 - Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. 2 projects. Only one will work at a time 无法在MVC 5中加载文件或程序集&#39;System.Web.Mvc&#39; - Could not load file or assembly 'System.Web.Mvc' in mvc 5 无法加载文件或程序集“ System.Web.MVC,版本4.0.0.0” - could not load file or assembly 'System.Web.MVC, version 4.0.0.0,' 无法加载文件或程序集System.Web.Mvc,版本= 5.2.3.0 - Could not load file or assembly System.Web.Mvc, Version=5.2.3.0 无法在单元测试中加载文件或程序集&#39;System.Web.Mvc - Could not load file or assembly 'System.Web.Mvc In Unit Test 无法加载文件或程序集System.Web.Mvc - Could not load file or assembly System.Web.Mvc
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM