Dan*_*ann 1 c# servicestack servicestack-bsd
我使用ServiceStack版本3.9.71,我找不到"添加"方法.维基上的文档是否已过时?我该怎么办才能让它发挥作用?
public override void Configure(Container container)
{
this.ServiceExceptionHandler.Add((httpReq, request, exception) => {
return DtoUtils.CreateErrorResponse(request, exception);
});
}
Run Code Online (Sandbox Code Playgroud)
您正在查看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);
};
Run Code Online (Sandbox Code Playgroud)
请注意v3网址中的:https://github.com/ServiceStackv3/ServiceStackv3/wiki