public Task InvokeAsync(HttpContext context, RequestDelegate next) { // 两种方式实现服务获取 IGuidService guidService = context.RequestServices.GetService <IGuidService>(); context.Response.WriteAsync(_guidService.Guid()); return(next(context)); }