2010-06-28 31 views
2

在我的RESTful服務層中,冒泡到我的任何異常都被捕獲爲Fault Exceptions。在該FaultException中,存在包含<errorNumber><errorCode><message>的自定義XML消息。我將異常重新封裝爲WebFaultException,以便我可以將響應頭的HttpStatusCode設置爲400,401,404等。WebFaultException傳回XML消息而不是字符串?

但是,我不想使用WebFaultException<string>(string message, HttpStatusCode code)。我希望消息也是一個XML消息。

任何人都看過如何設置響應消息的HttpStatusCode並設置XML消息?我使用Fiddler來檢查我的響應標題和服務中出現的任何消息。

回答

相關問題