throw new AppException("出错了");

使用步骤:

  1. 引用RsCode.AspNetCore.dll

  2. 添加日志服务,在ConfigureServices services.AddLogging(); 配置log4net

  3. 添加异常过滤

    services.AddExceptionFilter();
    
  4. 添加异常中间件
    app.UseExceptionFilter();
    

Webapi将返回统一消息格式

results matching ""

    No results matching ""