0

我有一个 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
4

1 回答 1

0

MSDN 有一篇用于解决 xml 序列化问题的文章。这里要发布的信息太多了。我将从这里的文章开始。

但是,第一步应该是尝试到达内部异常,这应该更具体。

于 2010-08-19T03:42:35.980 回答