3

我想從WCF的DataContract中返回一個異常數組,但它不起作用。包含DataContractSerializer的DataMember異常WCF C#

[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. 

我註釋掉/忽略例外列表中的數據成員,我能得到返回結果完美。

謝謝!

+0

並非所有的異常都是可序列化的。什麼是客戶端連接到WCF服務? – cadrell0 2013-05-14 16:51:10

+0

現在即時通訊只是在c#中使用控制檯應用程序進行測試# – Ramie 2013-05-14 17:01:06

回答

4

我相信ExceptionDetail類是你正在尋找。

+0

任何想法如何將異常轉換爲ExceptionDetail? – Ramie 2013-05-14 17:01:26

+0

沒關係,我明白了,謝謝 – Ramie 2013-05-14 17:12:25