2014-10-24 12 views
15

Il mio progetto utilizza ASP.NET MVC4, in C# con Visual Studio 2012 per Web Express.Errore EntityFramework: il provider non ha restituito un'istanza ProviderManifest

Quando si compila il mio progetto, ho il seguente errore:

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

Dopo molte ore di ricerca Credo che questo sia l'errore è in qualche modo legato alla Entity Framework. Ho anche trovato un lavoro in giro per questo errore qui: http://forums.devart.com/viewtopic.php?f=32&t=25748

La soluzione suggerisce che a cambiare il campo ProviderManifestToken="2012"-ProviderManifestToken="2008" nel mio file .edmx.

Dopo aver fatto ciò, l'errore scompare. Ma poi ho un altro problema quando si esegue il progetto, un errore di runtime:

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.

dello stack:

[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 è il nome del progetto. Dopo aver visto questo errore, ho trascorso diverse ore credendo che gli errori mentissero da qualche parte nelle versioni del pacchetto in uso. Tuttavia, questo non sembra essere il caso, dal momento che la maggior parte dei pacchetti sono aggiornati e non sembrano esserci conflitti tra di loro.

Di conseguenza, torno a credere che il problema risieda nella versione di EntityFramework, ma non ho idee su come risolvere questo problema.

Sono tutto orecchie, se avete qualche suggerimento, li apprezzerò.

+1

hm .. hai eseguito l'upgrade/downgrade tra Entity Framework 5 e Entity Framework 6? – Default

+1

Quale versione della dll Entity Framework si trova nella cartella bin? Puoi confrontarlo con la versione che il programma si aspetta? – Default

+1

Se si controlla il database, la tabella '__MigrationHistory' si trova in 'Tabelle di sistema' o 'Tabelle utente'? – Default

risposta

7

A parte questo, il problema era la versione di Visual Studio che stavo usando. Mente che soffia se me lo chiedi. Dopo aver rimosso Visual Studio Web Express 2012 e installato Visual Studio 2013 Ultimate, tutto ha iniziato a funzionare come dovrebbe.

+1

Ho avuto lo stesso problema. VS2012 Premium ha avuto l'errore. VS2013 Premium lo ha costruito bene. Lo riapri in VS2012 e fallisce di nuovo. Nessuna idea. Strano. – granadaCoder

1

Questo ha funzionato per me senza modificare ProviderManifestToken = "2012" a 2008 nel file .edmx.

nel file .edmx, ho modificato il seguente valore da Vero a Falso.

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

"Il provider non ha restituito un'istanza ProviderManifest." l'errore è andato via.

+0

Questa è una risposta molto migliore rispetto a quella che suggerisce che il valore dell'attributo ProviderManifestToken viene modificato dal 2012 al 2008. L'utilizzo di 2008 impedisce a Entity Framework di utilizzare funzionalità specifiche di SQL 2012, come OFFSET e FETCH. – Pando

1

Non sono sicuro se si tratta di un problema di Visual Studio. O solo il framework di entità non è in grado di riconoscere correttamente il provider manifest. mi sono liberato dell'errore modificando il file edmx e la sua sostituzione con 20122008 nel <Schema ProviderManifestToken="2008" ...>

2

Questo accade perché VS2012 non supporta SQL 2012 e sopra. Modificare il valore di ProviderManifestToken in 2008

0
  1. andare dove si trova il progetto (aprire Solution explorer.right fare clic su soluzione e fare clic su "Apri cartella in Esplora file"
  2. aprire file EDMX con blocco note e modificare ProviderManifestToken = "2012" a ProviderManifestToken = "2008". salvare si

  3. generare la soluzione

+0

Questo era già menzionato nella domanda stessa. –

1

Sostituzione 2012 con 2008 a ProviderManifestToken="2012" nel file .edmx lavorato per me.

  1. Sostituire 2012 con 2008 a ProviderManifestToken="2012"
  2. Salvare il file .edmx
  3. e ricostruire soluzione
0

Per me è stato perché quando ho usato TeamCity a deply mio sito, è cambiato il file web.config.

rimosso il connectionString e ha aggiunto il debug = true per System.Web compilation

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

ho manuel fissato il file web.config, e ora lavora per me.

Problemi correlati