2014-01-17 6 views
33

Wenn ich meine MVC4 Web-Anwendung ausführen es gibt mir folgende Fehlermeldung:Konnte Datei oder Assembly ‚WebGrease‘ oder eine ihrer Abhängigkeiten laden

Could not load file or assembly 'WebGrease' 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 'WebGrease' 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. 

Ich hatte web.config wie:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 

nach ein paar Antworten auf SO beziehe, habe ich es zu:

<dependentAssembly> 
     <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
     <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> 
     </dependentAssembly> 

Aber es ist immer noch nicht funktioniert.

Was kann das Problem sein?

Edit:

enter image description here

Edit 2:

Wieder folgende Fehler nach der Installation des Pakets:

Server Error in '/' Application. 

Configuration Error 

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load file or assembly 'MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified. 

Source Error: 


Line 249:  <providers> 
Line 250:  <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /> 
Line 251:  <add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /> 
Line 252:  </providers> 
Line 253: </membership> 

Bitte helfen Sie mir, ich bin erstes Mal arbeitet MVC4 Kendu Anwendung .

+0

Sie die Montage existieren auf der Festplatte? – scheien

+0

@schichten wie überprüft man das? –

+0

Überprüfen Sie das Verzeichnis/bin/debug im Projektverzeichnis, oder Sie können die Referenzen im Projekt bearbeiten. Fehlende Baugruppen sollten ein gelbes Symbol haben. – scheien

Antwort

53

Ich hatte das gleiche Problem.

Dies wurde durch

aufgelöst

1)

2) in Console den Package Manager-Konsole ausgeführt wird, geben: 'Install-Package Microsoft.AspNet.Web.Optimization'

die alle gelöst die falsche Abhängigkeiten.

+3

nach dem Upgrade WebGrease zu nugget Paket 1.6.0, die verbindliche Weiterleitung wurde nicht aktualisiert. Also, Neuinstallation von Microsoft.AspNet.Web.Optimization für mich korrigiert. Immerhin hat meine web.config jetzt den richtigen Eintrag: https: //gist.github.com/jpolvora/8864750c4e3fd9f3d961 –

+0

Jone Polvora, das hat das Problem für mich behoben. – AshleyS

+0

Benötigt folgendes für mich: Update-Paket -install Microsoft.AspNet.Web.Optimization –

3

Überprüfen Sie den Inhalt des Abschnittes runtime/assemblyBinding in web.config. Ich habe nach der Installation des Kendo-UI-Pakets falsch registrierte dependentAssembly-Elemente gefunden. Ich habe Duplikate manuell entfernt und das Problem ist verschwunden.

3

Ich hatte Update-Package -Reinstall Microsoft.AspNet.Web.Optimization

Das aktualisiert meine web.config und alle Verweise

3

Ersetzen auszuführen:

<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />

Für:

<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> 
    <bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" /> 
2

Dieses Problem tritt auf whe Ihre referenzierte DLL kann sich von Ihrer web.config Dateikonfiguration unterscheiden. Sie müssen die DLL neu installieren.

1

Nur Update WebGrease bis 1,6

PM> Update-Package WebGrease -Version 1.6 
Verwandte Themen