2014-10-24 10 views
15

Mein Projekt verwendet ASP.NET MVC4 in C# mit Visual Studio 2012 für Web Express.EntityFramework-Fehler: Der Provider hat keine ProviderManifest-Instanz zurückgegeben

Als mein Projekt kompilieren, habe ich folgende Fehlermeldung:

The provider did not return a ProviderManifest instance. Could not determine storage version; a valid storage connection or a version hint is required.

Nach vielen Stunden der Suche glaube ich, dass ist Fehler irgendwie zu Entity Framework verwandt ist. Ich fand auch eine Arbeit um für diesen Fehler hier: http://forums.devart.com/viewtopic.php?f=32&t=25748

Die Abhilfe schlägt vor, dass ich das Feld ProviderManifestToken="2012"-ProviderManifestToken="2008" in meiner .edmx Datei ändern.

Danach geht der Fehler weg. Aber dann habe ich ein anderes Problem, wenn ich das Projekt ausführen, einen Laufzeitfehler:

Could not load file or assembly 'Microsoft.Data.Edm' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Data.Edm
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.Data.Edm | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/
LOG: Initial PrivatePath = C:\Users\Pedro\Documents\Visual Studio 2012\Projects\Dockis\Development\Dockis\Dockis\bin
Calling assembly : (Unknown).

LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Pedro\Documents\Visual Studio 2012\Projects\Dockis\Development\Dockis\Dockis\web.config
LOG: Using host configuration file: C:\Users\Pedro\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm/Microsoft.Data.Edm.DLL.
LOG: Attempting download of new URL file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/bin/Microsoft.Data.Edm.DLL.
LOG: Using application configuration file: C:\Users\Pedro\Documents\Visual Studio 2012\Projects\Dockis\Development\Dockis\Dockis\web.config
LOG: Using host configuration file: C:\Users\Pedro\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 5.6.0.0 redirected to 5.6.1.0.
LOG: Post-policy reference: Microsoft.Data.Edm, Version=5.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm/Microsoft.Data.Edm.DLL.
LOG: Attempting download of new URL file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/bin/Microsoft.Data.Edm.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Stack Trace:

[FileLoadException: Could not load file or assembly 'Microsoft.Data.Edm' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] 

[FileLoadException: Could not load file or assembly 'Microsoft.Data.Edm, Version=5.6.1.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)] 
    System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 
    System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34 
    System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152 
    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77 
    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16 
    System.Reflection.Assembly.Load(String assemblyString) +28 
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38 

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Data.Edm, Version=5.6.1.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)] 
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752 
    System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218 
    System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 
    System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 
    System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 
    System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285 
    System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +521 

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Data.Edm, Version=5.6.1.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)] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9950728 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 

Dockis ist der Name des Projekts. Nachdem ich diesen Fehler gesehen hatte, verbrachte ich mehrere Stunden damit zu glauben, dass die Fehler irgendwo in den Versionen des verwendeten Pakets lagen. Dies scheint jedoch nicht der Fall zu sein, da die Mehrzahl der Pakete aktuell ist und keine Konflikte zwischen ihnen zu bestehen scheinen.

Folglich bin ich wieder zu glauben, dass das Problem mit der Version von EntityFramework liegt, aber ich habe keine Ideen, wie Sie das beheben können.

Ich bin ganz Ohr, wenn Sie irgendwelche Vorschläge haben, werde ich sie zu schätzen wissen.

+1

hm .. Haben Sie ein Upgrade/Downgrade zwischen Entity Framework 5 und Entity Framework 6 durchgeführt? – Default

+1

Welche Version der Entity Framework-DLL befindet sich in Ihrem bin-Ordner? Können Sie es mit der Version vergleichen, die das Programm erwartet? – Default

+1

Wenn Sie Ihre Datenbank überprüfen, befindet sich die Tabelle '__MigrationHistory' in' System Tables' oder 'User Tables'? – Default

Antwort

7

Aparently, das Problem war die Visual Studio-Version, die ich verwendete. Wahnsinn, wenn du mich fragst. Nach dem Entfernen von Visual Studio Web Express 2012 und dem Installieren von Visual Studio 2013 Ultimate hat alles ordnungsgemäß funktioniert.

+1

Ich hatte das gleiche Problem. VS2012 Premium hatte den Fehler. VS2013 Premium hat es in Ordnung gebaut. Wiedereröffnet in VS2012, und es ist wieder fehlgeschlagen. Keine Ahnung. Seltsam. – granadaCoder

1

Dies funktionierte für mich ohne Änderung der ProviderManifestToken = "2012" bis 2008 in der EDMX-Datei.

in der EDMX-Datei habe ich den folgenden Wert von True in False geändert.

<edmx:DesignerProperty Name="UseLegacyProvider" Value="False" /> 

Die "Der Provider hat keine ProviderManifest-Instanz zurückgegeben." Fehler ging weg.

+0

Dies ist eine viel bessere Antwort als die, die vorschlagen, dass der ProviderManifestToken-Attributwert von 2012 auf 2008 geändert wurde. Durch die Verwendung von 2008 wird verhindert, dass das Entity Framework SQL 2012-spezifische Funktionen wie OFFSET und FETCH verwendet. – Pando

1

Nicht sicher, ob es ein Visual Studio-Problem ist. Oder nur das Entity-Framework kann das Provider-Manifest nicht korrekt erkennen. habe ich die Fehler beseitigen, indem Sie die edmx Datei und das Ersetzen 2012 mit 2008 im <Schema ProviderManifestToken="2008" ...>

2

Dies geschieht, weil VS2012 nicht SQL 2012 und höher unterstützt wird. Ändern Sie den Wert von ProviderManifestToken bis 2008

0
  1. gehen, wo Sie befindet sich projizieren (offene Lösung Explorer.rechts Klick auf Lösung und klicken Sie auf "Ordner öffnen in Datei-Explorer"
  2. offen EDMX-Datei mit dem Notepad und ändern ProviderManifestToken = "2012" ProviderManifestToken = "2008". speichern es

  3. bauen Ihre Lösung

+0

Dies wurde bereits in der Frage selbst erwähnt. –

1

Austausch 2012 mit 2008 in ProviderManifestToken="2012" in der .edmx Datei für mich gearbeitet.

  1. Ersetzen 2012 mit 2008 in ProviderManifestToken="2012"
  2. Speichern, um die Datei .edmx
  3. reinigen und wieder aufbauen Lösung
0

Für mich war es denn, wenn ich Teamcity verwendet meine Seite deply, es ist die veränderte web.config-Datei.

Es entfernt die Connectionstring und hinzugefügt debug = true System.Web Kompilation

<system.web> 
    <customErrors mode="Off" /> 
    <authentication mode="None" /> 
    <compilation debug="true" targetFramework="4.5.2" /> 
    <httpRuntime targetFramework="4.5.2" maxRequestLength="1048576" /> 
    <httpModules> 
     <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> 
    </httpModules> 
    </system.web> 

ich manuel die Datei web.config festgelegt, und es funktioniert wieder für mich jetzt.

Verwandte Themen