1

我正在使用 ServiceStack 版本 3.9.71,但找不到“添加”方法。wiki上的文档是否已过时?我应该怎么做才能使它工作?

public override void Configure(Container container)
{
    this.ServiceExceptionHandler.Add((httpReq, request, exception) => {
        return DtoUtils.CreateErrorResponse(request, exception);
    });
}
4

1 回答 1

5

您正在查看 v4 文档。您需要v3 文档

//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);
};

注意v3url 中的 's:https ://github.com/ServiceStackv3/ServiceStackv3/wiki

于 2014-08-13T10:45:17.057 回答