我使用实体框架,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)

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


当前回答

我正在通过FTP更新一个网站。我假设网站正在使用中,当尝试更新bin文件夹时,几个DLL文件必须被锁定并且没有更新。

在那里,我看到了错误500页,并将customErrors模式设置为关闭,看到了OP提到的错误消息。

问题是我没有看到FTP程序中列出的失败。我重试了那些失败的失败,他们上传。更新了最后一个DLL文件。于是这个网站就成功了。

其他回答

还要检查在.csproj文件中是否没有<Private>True</Private>用于未加载的程序集

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

如果部署到IIS,请确保允许在IIS上使用32位应用程序。您可以在当前应用程序池的设置上定义这一点。

我也是这样。我的解决方法如下: 右键单击解决方案,管理解决方案的NuGet包… 合并包并将包升级为相同的版本。

两种可能的解决方案:

您正在以发布模式编译,但从Debug目录部署了较旧的编译版本(反之亦然)。 您的测试环境中没有安装正确的. net Framework版本。