app.Use(new Func
<
Func<IDictionary<string, object>, Task>,Func<IDictionary<string, object> , Task>
>(next => async env =>
{
string before = "Middleware1--Before(inline)" + Environment.MachineName;
string after = "Middleware1--After(inline)" + Environment.NewLine;
var response = env["owin.ResponseBody"] as Stream;
await response.WriteAsync(Encoding.UTF8.GetBytes(before), 0, before.Length);
await next.Invoke(env);
await response.WriteAsync(Encoding.UTF8.GetBytes(after), 0, after.Length);
}));
请问上面的语法中, 为什么async env 访问的到的是返回值委托中的入参,
建议给代码加上高亮
– dudu 6年前