0
我有一個基於wcf的系統,它使用IRequestChannel通過通道發送原始WCF消息。儘管服務契約並未提前知道,但故障契約是已知的,所以我知道每次出現故障消息時,都應映射到FaultException類型。從wcf消息創建FaultException
此外,我們正在使用的XmlSerializer進行序列化,因爲DCS是很挑剔..
例如下面
var requestChannel = this.GetRequestChannel();
using (requestChannel as IDisposable)
{
responseMessage = requestChannel.Request(requestMessage);
}
if (responseMessage.IsFault)
{
throw new ApplicationException("Fault");
}
有沒有辦法從信息創建通用故障異常情況?
你喜歡什麼樣的故障異常?除了'new FaultException()'之外的東西? –
我知道所有的故障信息都是某種類型的,比如說TDetail。所以理想情況下,我想創建新的FaultException(responseMessage); –
我不明白你的問題是什麼。只是拋出新FaultException(params);' –