我正在使用 ServiceStack 版本 3.9.71,但找不到“添加”方法。是关于 wiki 的文档吗?过时?我应该怎么做才能让它发挥作用?
public override void Configure(Container container)
{
this.ServiceExceptionHandler.Add((httpReq, request, exception) => {
return DtoUtils.CreateErrorResponse(request, exception);
});
}
您正在查看 v4 文档。你需要 v3 documentation .
//Handle Exceptions occurring in Services:
this.ServiceExceptionHandler = (httpReq, request, exception) => {
//log your exceptions here
...
//call default exception handler or prepare your own custom response
return DtoUtils.HandleException(this, request, exception);
};
注意 url 中的 v3
:https://github.com/ServiceStackv3/ServiceStackv3/wiki
我是一名优秀的程序员,十分优秀!