ServiceStack ServiceExceptionHandler.Add方法不存在?

时间:2014-08-13 10:07:44

标签: c# servicestack servicestack-bsd

我正在使用ServiceStack版本3.9.71,我找不到“添加”方法。 wiki上的文档是否过时了?我该怎么办才能让它发挥作用?

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

1 个答案:

答案 0 :(得分:5)

您正在查看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);
};

请注意网址中的v3https://github.com/ServiceStackv3/ServiceStackv3/wiki