2013-02-04 19 views
17

Tôi đang sử dụng umbraco 4.11.3 trong dự án của mình. Dự án của tôi hoạt động tốt trên Windows 7 và chạy nó từ studio trực quan 2012. Nhưng nó không hoạt động Chiến thắng 8 khi nó chạy từ visual studio 2012!Không thể tải tệp hoặc lắp ráp System.Web.Mvc

Lỗi là:

Could not load file or assembly 'System.Web.Mvc, Version=2.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)

Description: An unhandled exception occurred during the execution of the current web request. 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. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

An unhandled exception was generated during the execution of the current web request. 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.

=== 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. === 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. 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. 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. LOG: Attempting download of new URL file:///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). 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. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
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.ValidateCurrentHandler(IEnumerable`1 filters) +127
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

Lưu ý: Dự án được công bố trên IIS hoạt động tốt trong win7 và win8. Dự án của tôi không dựa trên ASP.NET MVC. Xin hãy giúp tôi.

+1

là hỗ trợ .NET 2.0 được cài đặt vào máy chủ web IIS của bạn? nếu vậy thì thiết lập ứng dụng có sử dụng Hồ bơi ứng dụng chính xác không? với sự hỗ trợ này .Net 3.5 nên được thêm vào và sau đó bạn cần ASP.NET MVC Framework tôi sẽ khuyên bạn nên cài đặt 1,2,3 & 4 theo thứ tự đó để giữ các tệp tại chỗ –

+0

@MartinBarker Tải xuống tất cả các phiên bản MVC là _not_ cách để giải quyết vấn đề này, vì nó sẽ chỉ che giấu một vấn đề tiềm năng và có khả năng truyền bá cùng một vấn đề này trên các dự án tương lai của người dùng này. – Digbyswift

+1

@MartinBarker: Cảm ơn rất nhiều. Tôi đã cài đặt ASP.NET MVC2 từ http://www.microsoft.com/en-us/download/details.aspx?id=22079 trên win8 và vấn đề của tôi đã được giải quyết. – Jahan

Trả lời

12

Chúng tôi đang sử dụng Azure cloud để chạy triển khai và tôi gặp lỗi tương tự. Vì bạn không thể cài đặt các gói lên các cá thể máy chủ, cách để giải quyết vấn đề này là vào phần Tài liệu tham khảo cho dự án của bạn, tìm tham chiếu đến thư viện mà nó đang thiếu, đi vào các thuộc tính, sau đó đặt Copy Local thành True. Triển khai lại và bạn đã hoàn tất.

6

Tôi giả định đây là một máy mới, khi bạn có hệ điều hành mới và phiên bản Visual Studio khác. Tôi nghĩ rằng bạn cần phải cài đặt MVC Framework phiên bản 2, vì đó là những gì cài đặt Umbraco của bạn đang mong đợi. Bạn có thể cài đặt Framework, và lấy các DLL vào GAC của bạn, hoặc sao chép các DLL từ hệ thống tốt của bạn vào thư mục bin của ứng dụng web của bạn.

Lưu ý, bạn đang nói dự án của mình "không sử dụng" MVC, nhưng tôi nghĩ bạn sẽ tìm thấy Umbraco. Lỗi, ở mức nào, nói với bạn rằng hệ thống hy vọng sẽ tìm thấy nó.

+0

: Cảm ơn rất nhiều. Tôi đã cài đặt ASP.NET MVC2 từ microsoft.com/en-us/download/details.aspx?id=22079 trên win8 và vấn đề của tôi đã được giải quyết. – Jahan

3

Umbraco 4.11.3 không sử dụng MVC2, nó sử dụng MVC3 vì vậy tôi đoán rằng bạn có một tham chiếu trong web.config của bạn vào thư viện MVC2, có thể trong phần compilation > assemblies. Hình ảnh trông giống như sau:

<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> 
+0

Trong web.config của tôi, trong phần biên dịch> assembly: Jahan

+2

Ok, nhưng lỗi bạn đã đăng không trỏ đến tham chiếu đến Phiên bản 2 trong tệp cấu hình. Bạn đã kiểm tra phần còn lại của web.config chưa? Xin lỗi vì đã hỏi rõ ràng. – Digbyswift

+0

Cảm ơn sự quan tâm của bạn về vấn đề của tôi nhưng giải pháp Jonathan hoàn hảo. – Jahan

4

Việc sửa chữa chính xác cho vấn đề này là:

  1. Nhấp chuột phải vào References trong Solution Explorer của bạn và chọn Manage NuGet Packages
  2. Ở phía bên trái chọn Updates
  3. Trong phần giữa chọn Microsoft ASP.NET MVC
  4. Bạn sẽ thấy một nút Update xuất hiện trong lựa chọn của bạn, nhấp vào nó

Đó là ... chấp nhận bất kỳ T & C nào có thể bật lên và xuất bản hoặc chạy dự án của bạn cục bộ. Nếu bạn vẫn gặp sự cố khi chạy dự án của mình tại địa phương, hãy thử đóng Visual Studio xóa tệp .SUO cho dự án và thử mở lại giải pháp ... thử chạy lại.

+0

Cảm ơn người đàn ông, tôi kinda ghét ASP.NET cho những thứ –

+1

Thật là một bước đơn giản tuyệt vời để làm theo mà chắc chắn sẽ bắt được nhiều vấn đề như vậy trước khi chúng ta đi sâu vào công cụ và tạo ra nhiều vấn đề hơn. Cám ơn!! – Alan