首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >EntityFramework错误:提供程序没有返回ProviderManifest实例

EntityFramework错误:提供程序没有返回ProviderManifest实例
EN

Stack Overflow用户
提问于 2014-10-24 15:53:06
回答 9查看 28.8K关注 0票数 17

我的项目是在VisualStudio2012forWebExpress的ASP.NET MVC4中使用C#。

在编译我的项目时,我有以下错误:

提供程序没有返回ProviderManifest实例。无法确定存储版本;需要有效的存储连接或版本提示。

经过几个小时的搜索,我相信错误与实体框架有某种联系。我还在这里找到了一个解决此错误的方法:http://forums.devart.com/viewtopic.php?f=32&t=25748

解决方法建议我将ProviderManifestToken="2012"字段更改为ProviderManifestToken="2008"文件中的.edmx文件。

这样做之后,错误就消失了。但是,当我运行该项目时,我遇到了另一个问题,一个运行时错误:

无法加载文件或程序集“Microsoft.Data.Edm”或其依赖项之一。所定位的程序集的清单定义与程序集引用不匹配。(HRESULT例外: 0x80131040) ===预绑定状态信息=== 日志: DisplayName = Microsoft.Data.Edm (部分) WRN:为程序集提供了部分绑定信息: WRN:程序集名称: Microsoft.Data.Edm @ Domain :2 WRN:当只提供程序集显示名称的一部分时,会发生部分绑定。 WRN:这可能会导致绑定程序加载错误的程序集。 WRN:建议为程序集提供完整的文本标识, WRN:这包括简单的名称、版本、区域性和公钥令牌。 WRN:有关此问题的更多信息和常见解决方案,请参见白皮书http://go.microsoft.com/fwlink/?LinkId=109270。 LOG: Appbase = file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/ 日志:初始2012\Projects\Dockis\Development\Dockis\Dockis\bin =C:\ PrivatePath \Pedro\Documents\Visual 调用程序集:(未知)。LOG:此绑定在默认加载上下文中启动。 日志:使用应用程序配置文件: C:\Users\Pedro\Documents\Visual 2012\Projects\Dockis\Development\Dockis\Dockis\web.config 日志:使用主机配置文件: C:\Users\Pedro\Documents\IISExpress\config\aspnet.config 日志:使用C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.中的机器配置文件日志:此时未应用于引用的策略(私有、自定义、部分或基于位置的程序集绑定)。 日志:尝试下载新的URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm.DLL. 日志:尝试下载新的URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm/Microsoft.Data.Edm.DLL. 日志:尝试下载新的URL file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/bin/Microsoft.Data.Edm.DLL. 日志:使用应用程序配置文件: C:\Users\Pedro\Documents\Visual 2012\Projects\Dockis\Development\Dockis\Dockis\web.config 日志:使用主机配置文件: C:\Users\Pedro\Documents\IISExpress\config\aspnet.config 日志:使用C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.中的机器配置文件 LOG:在应用程序配置文件中找到重定向: 5.6.0.0重定向到5.6.1.0。 日志:政策后参考: Microsoft.Data.Edm,Version=5.6.1.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35 日志:尝试下载新的URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm.DLL. 日志:尝试下载新的URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/vs/78aa89a1/af9f01eb/Microsoft.Data.Edm/Microsoft.Data.Edm.DLL. 日志:尝试下载新的URL file:///C:/Users/Pedro/Documents/Visual Studio 2012/Projects/Dockis/Development/Dockis/Dockis/bin/Microsoft.Data.Edm.DLL. WRN:比较程序集名称导致不匹配:生成编号 错误:未能完成程序集的设置(hr = 0x80131040)。探测结束了。

堆栈跟踪:

代码语言:javascript
代码运行次数:0
运行
复制
[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是该项目的名称。在看到这个错误后,我花了几个小时的时间,相信这些错误存在于正在使用的包的版本中。然而,情况似乎并非如此,因为大多数包都是最新的,而且它们之间似乎没有任何冲突。

因此,我再次相信问题在于EntityFramework的版本,但对于如何解决这个问题,我没有什么想法。

如果你有什么建议,我会很感激的。

EN

回答 9

Stack Overflow用户

回答已采纳

发布于 2014-10-28 08:50:32

显然,问题在于我正在使用的Visual版本。如果你问我的话,我不介意。删除2012并安装Visual 2013之后,一切都按其应有的方式开始工作。

票数 7
EN

Stack Overflow用户

发布于 2015-03-11 09:53:43

下载http://www.microsoft.com/en-us/download/details.aspx?id=40762并将Nuget更新为6.1.3,一切都会很好。

票数 16
EN

Stack Overflow用户

发布于 2016-07-04 01:31:47

ProviderManifestToken="2012"文件中用2008年的.edmx文件替换2012年对我很有帮助。

  1. ProviderManifestToken="2012"中用2008年取代2012年
  2. 保存.edmx文件
  3. 清洁重建溶液
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26551603

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档