实体框架 LoaderExceptions 无法加载一种或多种请求的类型

Dav*_*iff 4 entity-framework

我有一个使用实体框架的 Web 服务。当发布到测试环境时,我收到以下错误:

“无法加载一种或多种请求的类型。” - 下面的堆栈跟踪...

测试盒安装了.NET 3.5 SP 1,我已经在这里阅读了之前的帖子:

错误消息“无法加载一种或多种请求的类型。检索 LoaderExceptions 属性以获取更多信息。

然而,答案并不能解决我的情况。我已将开发计算机上的工作副本复制并粘贴到测试盒上,以确保调试 DLL 不存在问题(如答案所示),但运气不佳。

这是一个已知的问题?我花了整个早上尝试调试这个!如果有人知道解决方案,请告诉我!

Retrieve the LoaderExceptions property for more information.   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, Dictionary`2 knownAssemblies, Dictionary`2& 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)
   at Company.Domain.ICommuicationsEntities.CreateQuery[T](String queryString, ObjectParameter[] parameters)
   at Comany.EntityFrameworkRepository`1.GetQuery()
   at Comany.Repositories.EntityFrameworkRepository`1.GetFiltered(Expression`1 filter, IncludeBuilder`1 includeBuilder)
   at Comany.Repositories.EntityFrameworkRepository`1.GetFiltered(Expression`1 filter)
Run Code Online (Sandbox Code Playgroud)

Cra*_*ntz 5

正如堆栈的顶行所示:

检索LoaderExceptions属性以获取更多信息。

您可以通过检查调试器中的异常来找到这一点。