尝试实现OWIN中间件,但不知道如何读取响应 在IAppBuilder中 下面是我的owin invoke方法。 我不知道如何在启动方法 MyWebApi(IAppBuilder Iapp,HttpConfiguration config)中读取响应
public override async Task Invoke(IOwinContext context)
{
var response = context.Response;
var request = context.Request;
if(NoAuthorization){
response.StatusCode = 403;
return;
}
await Next.Invoke(context);
//MyWebApi(IAppBuilder Iapp, HttpConfiguration config) method
config.Services.Replace(typeof(IExceptionHandler), new MyExceptionHandler());
config.Formatters.XmlFormatter.UseXmlSerializer = true;
config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings();
Iapp.Use(typeof(SaccrApi.Helpers.MyCustomMiddleware));