我有一个使用 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。
提前致谢。