Fix: 'Unable to load one or more of the requested types' Errors

来源:互联网 发布:手机看病软件 编辑:程序博客网 时间:2024/05/20 14:19

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>

原文链接:http://weblogs.asp.net/kencox/archive/2011/06/08/fix-unable-to-load-one-or-more-of-the-requested-types-errors.aspx?CommentPosted=true#commentmessage



原创粉丝点击