【问题标题】:ServiceStack ServiceExceptionHandler.Add method does not exists?ServiceStack ServiceExceptionHandler.Add 方法不存在?
【发布时间】:2023-04-01 00:47:01
【问题描述】:

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

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

【问题讨论】:

    标签: c# servicestack servicestack-bsd


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多