Fix: 'Unable to load one or more of the requested types' Errors
A long time ago, I reported on an intermittent ‘Could not load file or assembly‘ bug where ASP.NET 4 was encountering a bizarre error on start-up in System.Reflection.RuntimeModule.GetTypes(RuntimeModule module). I neglected to post a follow-up here.
The workaround is to always set the ContextTypeName property in your EntityDataSource. That is, you should set the ContextTypeName="ProjectNameNameSpace.EntityContainerName"
Here's an example of some mark-up:
<asp:EntityDataSource ID="edsCategoryTypesFilter"
runat="server"
ConnectionString="name=OfficeBookDBEntities1"
ContextTypeName="OfficeBook.OfficeBookDBEntities1"
DefaultContainerName="OfficeBookDBEntities1"
OrderBy="it.CategoryName"
EntitySetName="AccountTypeCategories"
EntityTypeFilter="AccountTypeCategories">
</asp:EntityDataSource>
I hope this helps somebody.
Ken