throw new AppException("出错了");
使用步骤:
引用RsCode.AspNetCore.dll
添加日志服务,在ConfigureServices
services.AddLogging();
配置log4net添加异常过滤
services.AddExceptionFilter();
- 添加异常中间件
app.UseExceptionFilter();
Webapi将返回统一消息格式
throw new AppException("出错了");
使用步骤:
引用RsCode.AspNetCore.dll
添加日志服务,在ConfigureServices
services.AddLogging();
配置log4net
添加异常过滤
services.AddExceptionFilter();
app.UseExceptionFilter();
Webapi将返回统一消息格式