/// <summary> /// 启用静态请求上下文对象 /// </summary> /// <param name="app"></param> /// <returns></returns> public static IApplicationBuilder UseStaticHttpContext(this IApplicationBuilder app) { var httpContextAccessor = app.ApplicationServices.GetRequiredService <IHttpContextAccessor>(); WorkContext.Configure(httpContextAccessor); return(app); }