我使用实体框架,SQL Server 2000, Visual Studio 2008和企业库开发了一个应用程序。

它在本地工作得非常好,但是当我将项目部署到我们的测试环境时,我得到了以下错误:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information Stack trace: at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) at System.Reflection.Assembly.GetTypes() at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadTypesFromAssembly(LoadingContext context) at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.InternalLoadAssemblyFromCache(LoadingContext context) at System.Data.Metadata.Edm.ObjectItemCollection.AssemblyCacheEntry.LoadAssemblyFromCache(Assembly assembly, Boolean loadReferencedAssemblies, Dictionary2 knownAssemblies, Dictionary2& typesInLoading, List`1& errors) at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies) at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyForType(Type type) at System.Data.Metadata.Edm.MetadataWorkspace.LoadAssemblyForType(Type type, Assembly callingAssembly) at System.Data.Objects.ObjectContext.CreateQuery[T](String queryString, ObjectParameter[] parameters)

实体框架似乎有问题,任何线索如何修复它?


当前回答

当我用Visual Studio 2015创建新的Microsoft Word插件时,我也遇到了这个问题。这个问题是关于我有两个版本的MS Office, 2013年和2016年。我卸载了MS Office 2013,然后它就工作了。

其他回答

我有一个。net 4.0, ASP。NET MVC 2.0,实体框架4.0 web应用程序开发在Visual Studio 2010。我遇到了同样的问题,它在一台Windows Server 2008 R2服务器上工作,但在另一台Windows Server 2008 R2服务器上不能工作,即使。net和ASP。NET MVC是一样的,抛出和你的一样的错误。

我听从了miko的建议,所以我在故障服务器上安装了Windows SDK v7.1 (x64),这样我就可以运行!dumpheap了。

事实证明,安装Windows SDK v7.1 (x64)解决了这个问题。任何缺失的依赖项都必须包含在SDK中。它可以从微软Windows SDK for Windows 7和。net Framework 4下载。

我在自动地图上出了点问题。在bin文件夹中,automap.4net.dll文件在那里,但由于某种原因,automap.xml和automap.dll不在那里。将它们复制到bin目录就解决了这个问题。

在配置文件中将32位IIS模式设置为true,调试模式设置为true,删除临时目录并重置IIS可以暂时修复问题,一段时间后它会恢复。

当我用Visual Studio 2015创建新的Microsoft Word插件时,我也遇到了这个问题。这个问题是关于我有两个版本的MS Office, 2013年和2016年。我卸载了MS Office 2013,然后它就工作了。

我为SharePoint构建了一些项目,当然,也部署了它们。有一次发生了。

我在C:\Windows\assembly\temp\xxx(使用FarManager)中找到了一个旧的程序集,在重新启动后删除了它,并构建了所有项目。

我对MSBuild有疑问,因为在项目程序集中链接的项目和每个程序集都标记为“复制本地”,但不是从GAC。