当尝试使用带有WCF服务的SQL到Linq类时,只要服务尝试返回任何类型的集合,它就会失败。我得到的错误是CommunicationException - “远程服务器返回错误:NotFound。”
示例服务代码:
[OperationContract]
public Spell[] GetStoreSpells(long id)
{
IQueryable<Spell> spells = from s in db.Spells where !((from us in db.UserSpells where us.UserID == id select us.SpellID).Contains((int)s.SpellID)) orderby s.MinLevel select s;
return spells.ToArray();
}
用于检索的Silverlight端代码示例。
public static void GetStoreSpells(long userID, EventHandler<GetStoreSpellsCompletedEventArgs> complete)
{
client.GetStoreSpellsCompleted += complete;
client.GetStoreSpellsCompleted += delegate(object sender, GetStoreSpellsCompletedEventArgs e) { client.GetStoreSpellsCompleted -= complete; };
client.GetStoreSpellsAsync(userID);
}
我看了一遍,告诉我你不允许收藏,但找不到任何收藏品。如果我只做一个Spell对象的值,它可以正常工作。我真的需要它来返回某种数组或集合。
我做错了什么?有可能吗?
感谢。