0
我一直在为过去一天抛出ExecutionEngineException的web服务而苦苦挣扎。我终于弄明白Silverlight客户端不喜欢IEnumerable <> IList <>也不是列表<>作为返回类型。 MyObject []很好。HttpDuplexBinding web服务调用ExecutionEngineException
我设法复制它在试样溶液:
服务描述:
[ServiceContract]
public interface IService
{
[OperationContract]
IEnumerable<Person> SomeStuff();
}
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service : IService
{
public IEnumerable<Person> SomeStuff()
{
return new Person[] { new Person { Name = "some person", ID = 42 } };
}
}
[DataContract]
public class Person
{
[DataMember]
public string Name { get; set; }
[DataMember]
public int ID { get; set; }
}
在客户端,只需要创建一个服务引用和调用服务。服务返回后抛出异常。
任何想法是什么造成的问题,将不胜感激。