public static IApplicationBuilder UseJRPC(this IApplicationBuilder builder, string jrpcPath = "/jrpc") { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } using (var scope = builder.ApplicationServices.CreateScope()) { var services = scope.ServiceProvider; foreach (var svcType in registeredServiceType) { var svc = services.GetRequiredService(svcType); RPCServer.AddService(svc); } RPCServer.UserTokenManager(services.GetService <ITokenManager>()); RPCServer.UserMembership(services.GetService <IMembership>()); } builder.Map(jrpcPath, JRPCHandler); return(builder); }