我有ServiceStack不一致ServiceStack異常處理
public class GetContactMasterDataService : IService<GetContactMasterData>
{
public object Execute(GetContactMasterData getContactMasterData)
{
return ContactApi.FetchContactMasterData();
}
}
建在不同的命名空間一個簡單的服務:
public class GetContactMasterData
{
}
public class GetContactMasterDataResponse
{
public ResponseStatus ResponseStatus { get; set; }
}
public static GetContactMasterDataResponse FetchContactMasterData()
{
throw new ApplicationException("CRASH");
}
當我送一個JSON請求我正確地得到:
{
"ResponseStatus":{
"ErrorCode":"ApplicationException",
"Message":"CRASH",
}
}
當我用soapUI發送soap12請求時,我得到了典型的死亡黃屏
<html>
<head>
<title>CRASH</title>
...
<h2> <i>CRASH</i> </h2></span>
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
...
<b> Exception Details: </b>System.ApplicationException: CRASH<br><br>
這是預期的行爲?我如何得到一個類似JSON響應的整齊序列化的ResponseStatus。
在此先感謝。
有什麼問題嗎? – 2012-08-14 21:40:52
抱歉提前張貼。已更新爲包含問題 – Alper 2012-08-14 21:47:38