将异常包含为DataContractSerializer WCF C的DataMember

时间:2013-05-14 16:48:07

标签: c# wcf exception-handling datacontractserializer datacontract

我想从WCF返回DataContract中的异常数组,但它无法正常工作。

    [DataContract]
    public class ProcessResult
    {
        [DataMember]
        public ProcessStatus EndStatus { get; set; }

        [DataMember]
        public Exception[] CaughtExceptionList { get; set; }

        [DataMember]
        public string CowListXML { get; set; }

    }

当我进行WCF调用时,我得到了这个异常

The underlying connection was closed: The connection was closed unexpectedly.

我评论/忽略了作为数据成员的例外列表,我能够完美地获得结果。

谢谢!

1 个答案:

答案 0 :(得分:5)

我相信ExceptionDetail课程正是你要找的。