Could not load file or assembly 'System.Web.Http.WebHost hatası

0

C# Asp.net MVC uygulaması lokalde çalışırken sunucuya yüklendiğinde aşağıdaki gibi hata veriyor: 

Could not load file or assembly 'System.Web.Http.WebHost, Version=5.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.Http.WebHost, Version=5.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.Http.WebHost, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Asp.Net uygulamasında Could not load file or assembly hatasının çözümü nedir?

alattin alattin (16984)
9 yıl önce sordu

  • Copy Local True değerini seçiyorum ama kendini otomatik olarak false değerine döndürüyor. Ne yapmam gerek acaba? emreyilmaz 7 yıl önce
  • @emreyilmaz manuel el ile o dosyayi uygulamanızın Bin klasörüne kopyalayın. Copy Local True derleme aşamasında Publish/bin klasörüne otomatik atmaya yarıyor. alattin 7 yıl önce

Toplam 1 Cevap


0

Asp.net uygulamasına erişmek istediğinizde Could not load file or assembly ...... gibi bir hata alıyorsanız uygulamanız hata mesajında belirtilen dosyayı veya assembly bulamıyor demektir. Bulunamayan dll dosyası sunucuya yüklenmemiş demektir. Hatanın çözümü için aşağıdaki adımları yerine getirin

  1. Visual Studio ile projenizi, Asp.Net projenizi açın.
  2. Hata mesajında belirtilen, bu örnekte System.Web.Http.WebHost,referansını projenizin References bölümünde bulun.
  3. Referanslar altındaki System.Web.Http.WebHost ifadesini sağ tuşla tıklayın ve Properties'i seçin.
  4. Özellikler penceresinde Copy Local = True şeklinde ayarlayın.
  5. Uygulamanızı tekrardan Publish edin.
  6. Şimdi Bin klasöründe System.Web.Http.WebHost için gerekli DLL dosyasını sunucuya yükleyin.
  7. Aynı hatayı başka DLL dosyaları için alırsanız Copy Local = True  ayarını onlar için de yapın.

Bu işlemden sonra Asp.Net uygulamasında alınan Could not load file or assembly hatası çözülmüş olacaktır.

alattin alattin (16984)
9 yıl önce cevaplandı

    üyelik gerektirir

    Cevap yazabilmek için üye girişi yapmalısınız.

    Eğer uzmanim.net üyesiyseniz giriş yapabilirsiniz: üye girişi yap
    uzmanim.net'e üye olmak çok kolaydır: hemen kayıt ol