views:

6236

answers:

6

I have developed an application using Entity Framework, SQL Server 2000, VS 2008 and Enterprise Library.

It works absolutely fine locally but when I deploy the project to our test environment, I am getting the following error:

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)

Entity Framework seems to have issue, any clue how to fix it?

+4  A: 

Two possible solutions:

  1. You are compiling in Release mode but deploying an older compiled version from your Debug directory. (Or vise versa )
  2. You don't have the correct version of the .Net Framework installed in your test environment.
William Edmondson
I had the same problem, point 1 was accurate for me. Thanks William.
Matthew
I have this same problem... I have gone through both of the two suggestions and still recieve the same error :(
David Kiff
It can also happen if your referenced DLL is "blocked". Right click on it, and select "unblock"
Ben
A: 

My instance of this problem ended up being a missing reference. An assembly was referred to in the app.config but didn't have a reference in the project.

SteveCav
A: 

One solution that worked for me was to delete the bin/ and obj/ folders and rebuild the solution.

Kenny Eliasson
A: 

Initially I tried the Fusion log viewer, but that didn't help so I ended up using WinDbg with the SOS extension.

!dumpheap -stat -type Exception /D

Then I examined the FileNotFoundExceptions. The message in the exception contained the name of the DLL that wasn't loading.

N.B., the /D give you hyperlinked results, so click on the link in the summary for FileNotFoundException. That will bring up a list of the exceptions. Then click on the link for one of the exceptions. That will !dumpobject that exceptions. Then you should just be able to click on the link for Message in the exception object, and you'll see the text.

miko
A: 

Hello, make sure you allow 32 bits apps on IIS if you did deploy to IIS. You can define this on the settings of your current Application Pool.

MrKhal