我的项目是在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)。探测结束了。
堆栈跟踪:
[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的版本,但对于如何解决这个问题,我没有什么想法。
如果你有什么建议,我会很感激的。
发布于 2014-10-28 00:50:32
显然,问题在于我正在使用的Visual版本。如果你问我的话,我不介意。删除2012并安装Visual 2013之后,一切都按其应有的方式开始工作。
发布于 2015-03-11 01:53:43
下载http://www.microsoft.com/en-us/download/details.aspx?id=40762并将Nuget更新为6.1.3,一切都会很好。
发布于 2016-07-03 17:31:47
在ProviderManifestToken="2012"
文件中用2008年的.edmx文件替换2012年对我很有帮助。
ProviderManifestToken="2012"
中用2008年取代2012年https://stackoverflow.com/questions/26551603
复制相似问题