我有一个 WebMethod,它将返回 List 对象,如下所示
[WebMethod]
public List<ContactMaster> GetContacts()
{
//ContactMaster contact = new ContactMaster();
List<ContactMaster> contacts=new List<ContactMaster>();
IQueryable<ContactMaster> contact = from c in db.ContactMasters
select c;
foreach (ContactMaster c in contact)
{
contacts.Add(c);
}
return contacts ;
}
当我尝试从客户端调用相同的方法时,出现如下错误
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException