简体   繁体   English

无法加载文件或程序集System.Web.Mvc

[英]Could not load file or assembly System.Web.Mvc

I'm using umbraco 4.11.3 in my project.My project work well util that's on Windows 7 and run it from visual studio 2012. But it did not work in Win 8 when it run from visual studio 2012! 我正在我的项目中使用umbraco 4.11.3。我的项目工作得很好,在Windows 7上运行并从visual studio 2012运行。但是当它从Visual Studio 2012运行时它在Win 8中不起作用!

Error is: 错误是:

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

Description: An unhandled exception occurred during the execution of the current web request. 描述:执行当前Web请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code. 请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 异常详细信息:System.IO.FileLoadException:无法加载文件或程序集'System.Web.Mvc,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 定位的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) (HRESULT异常:0x80131040)

Source Error: 来源错误:

An unhandled exception was generated during the execution of the current web request. 在执行当前Web请求期间生成了未处理的异常。 Information regarding the origin and location of the exception can be identified using the exception stack trace below. 可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded. 程序集加载跟踪:以下信息有助于确定无法加载程序集“System.Web.Mvc,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35”的原因。

=== Pre-bind state information === LOG: User = Jahan-PC\\jahan LOG: DisplayName = System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 (Fully-specified) LOG: Appbase = file:///G:/20130204/SourceCode/Defraz.Movafaqiyat.WebApp/Defraz.Movafaqiyat.WebApp/ LOG: Initial PrivatePath = G:\\20130204\\SourceCode\\Defraz.Movafaqiyat.WebApp\\Defraz.Movafaqiyat.WebApp\\bin Calling assembly : ClientDependency.Core.Mvc, Version=1.5.1.0, Culture=neutral, PublicKeyToken=null. ===预绑定状态信息===日志:用户= Jahan-PC \\ jahan日志:DisplayName = System.Web.Mvc,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35(完全指定)日志: Appbase = file:/// G:/20130204/SourceCode/Defraz.Movafaqiyat.WebApp/Defraz.Movafaqiyat.WebApp/日志:初始PrivatePath = G:\\ 20130204 \\ SourceCode \\ Defraz.Movafaqiyat.WebApp \\ Defraz.Movafaqiyat.WebApp \\ bin调用程序集:ClientDependency.Core.Mvc,Version = 1.5.1.0,Culture = neutral,PublicKeyToken = null。 === LOG: This bind starts in default load context. ===日志:此绑定在默认加载上下文中启动。 LOG: Using application configuration file: G:\\20130204\\SourceCode\\Defraz.Movafaqiyat.WebApp\\Defraz.Movafaqiyat.WebApp\\web.config LOG: Using host configuration file: C:\\Users\\jahan\\Documents\\IISExpress\\config\\aspnet.config LOG: Using machine configuration file from C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\config\\machine.config. 日志:使用应用程序配置文件:G:\\ 20130204 \\ SourceCode \\ Defraz.Movafaqiyat.WebApp \\ Defraz.Movafaqiyat.WebApp \\ web.config日志:使用主机配置文件:C:\\ Users \\ jahan \\ Documents \\ IISExpress \\ config \\ aspnet .config日志:使用C:\\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319 \\ config \\ machine.config中的计算机配置文件。 LOG: Post-policy reference: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 LOG: Attempting download of new URL file:///C:/Users/jahan/AppData/Local/Temp/Temporary ASP.NET Files/root/bc5b37d0/42db0b24/System.Web.Mvc.DLL. 日志:后策略引用:System.Web.Mvc,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35日志:尝试下载新的URL文件:/// C:/ Users / jahan / AppData / Local / Temp / Temporary ASP.NET Files / root / bc5b37d0 / 42db0b24 / System.Web.Mvc.DLL。 LOG: Attempting download of new URL file:///C:/Users/jahan/AppData/Local/Temp/Temporary ASP.NET Files/root/bc5b37d0/42db0b24/System.Web.Mvc/System.Web.Mvc.DLL. 日志:尝试下载新的URL文件:/// C:/ Users / jahan / AppData / Local / Temp / Temporary ASP.NET Files / root / bc5b37d0 / 42db0b24 / System.Web.Mvc / System.Web.Mvc.DLL 。 LOG: Attempting download of new URL file:///G:/20130204/SourceCode/Defraz.Movafaqiyat.WebApp/Defraz.Movafaqiyat.WebApp/bin/System.Web.Mvc.DLL. 日志:尝试下载新的URL文件:/// G:/20130204/SourceCode/Defraz.Movafaqiyat.WebApp/Defraz.Movafaqiyat.WebApp/bin/System.Web.Mvc.DLL。 WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). 警告:比较程序集名称导致不匹配:主要版本错误:无法完成程序集的设置(hr = 0x80131040)。 Probing terminated. 探测终止。

Stack Trace: 堆栈跟踪:

[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. [FileLoadException:无法加载文件或程序集'System.Web.Mvc,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 定位的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040)] (HRESULT异常:0x80131040)]
ClientDependency.Core.Mvc.MvcFilter.ValidateCurrentHandler() +0 ClientDependency.Core.Mvc.MvcFilter.ValidateCurrentHandler()+ 0
ClientDependency.Core.Module.ClientDependencyModule.b__0(IFilter f) +31 System.Linq.Enumerable.Any(IEnumerable 1 source, Func 2 predicate) +146 ClientDependency.Core.Module.ClientDependencyModule.b__0(IFilter f)+31 System.Linq.Enumerable.Any(IEnumerable 1 source, Func 2 predicate)+146
ClientDependency.Core.Module.ClientDependencyModule.ValidateCurrentHandler(IEnumerable`1 filters) +127 ClientDependency.Core.Module.ClientDependencyModule.ValidateCurrentHandler(IEnumerable`1过滤器)+127
ClientDependency.Core.Module.ClientDependencyModule.HandleRequest(Object sender, EventArgs e) +179 ClientDependency.Core.Module.ClientDependencyModule.HandleRequest(Object sender,EventArgs e)+179
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+ 136 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&completedSynchronously)+69

Note:published project on IIS works well in win7 and win8. 注意:IIS上发布的项目在win7和win8中运行良好。 My project isn't based on ASP.NET MVC. 我的项目不是基于ASP.NET MVC。 Please help me. 请帮我。

We're using Azure cloud to run a deployment and I got the same error. 我们使用Azure云来运行部署,我得到了同样的错误。 Since you can't really install packages onto the server instances, the way to solve this is to go into References for your project, find the reference to the library that it's complaining is missing, go into properties, then set Copy Local to True. 由于您无法真正将软件包安装到服务器实例上,解决此问题的方法是进入项目的引用,查找缺少其抱怨的库的引用,转到属性,然后将Copy Local设置为True。 Redeploy and you're all set. 重新部署,你就完全了。

I'm assuming this is a new machine, seeing as you have the new OS and different version of Visual Studio. 我假设这是一台新机器,因为你有新的操作系统和不同版本的Visual Studio。 I think you need to install MVC Framework version 2, as that's what your Umbraco install is expecting. 我认为您需要安装MVC Framework版本2,因为这是您的Umbraco安装所期望的。 You can either install the Framework, and get the DLLs into your GAC, or copy the DLLs from your good system to the bin folder of your web application. 您可以安装Framework,将DLL添加到GAC中,也可以将DLL从良好的系统复制到Web应用程序的bin文件夹中。

Note, you're saying your project "doesn't use" MVC, but I think you'll find Umbraco does. 注意,你说你的项目“不使用”MVC,但我想你会发现Umbraco的确如此。 The error, at any rate, is telling you that the system expects to find it. 无论如何,错误告诉您系统希望找到它。

The correct fix for this issue is to: 这个问题的正确解决方法是:

  1. Right-click on References in your Solution Explorer and choose Manage NuGet Packages 右键单击Solution Explorer References ,然后选择Manage NuGet Packages
  2. On the left side select Updates 在左侧选择Updates
  3. In the middle section select Microsoft ASP.NET MVC 在中间部分选择Microsoft ASP.NET MVC
  4. You should see an Update button appear in your selection, click on it 您应该会在选择中看到“ Update按钮,然后单击它

That's it...accept any T&Cs that might pop-up and either publish or run your project locally. 就是这样......接受任何可能弹出并在本地发布或运行项目的条款和条件。 If you're still having problems running your project locally, try closing Visual Studio deleting the .SUO file for the project and try opening the solution again...try running again. 如果您仍然无法在本地运行项目,请尝试关闭Visual Studio,删除项目的.SUO文件,然后尝试再次打开解决方案...再次尝试运行。

Umbraco 4.11.3 doesn't use MVC2, it uses MVC3 so I would guess that you have a reference in your web.config to the MVC2 library, possibly in the compilation > assemblies section. Umbraco 4.11.3不使用MVC2,它使用MVC3所以我猜你在web.config中有一个引用到MVC2库,可能在compilation > assemblies部分。 It should look something like this: 它应该看起来像这样:

<compilation defaultLanguage="c#" batch="false" targetFramework="4.0" debug="true">
  <assemblies>
    <!-- ASP.NET 4.0 Assemblies -->
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
  <!-- Added in Umbraco 4.6.2 -->
  <buildProviders>
    <add extension=".cshtml" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
    <add extension=".vbhtml" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
    <add extension=".razor" type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
  </buildProviders>
  <!-- End of added in Umbraco 4.6.2 -->
</compilation>

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

相关问题 无法在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 when trying to use endpoint 调用API服务时无法加载文件或程序集&#39;System.Web.Mvc&#39; - Could not load file or assembly 'System.Web.Mvc' when calling an API service 使用Autofac获取错误“无法加载文件或程序集&#39;system.web.mvc版本= 5.1.0.0” - Using Autofac get error “could not load file or assembly 'system.web.mvc version=5.1.0.0” 无法加载文件或程序集&#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 无法在“新”框中加载文件或程序集&#39;System.Web.Mvc,版本= 3.0.0.0 - Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0 on NEW box
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM