diff --git a/aspnetcore/signalr/hubcontext.md b/aspnetcore/signalr/hubcontext.md index 49fe04addd..1b6ce0bbe6 100644 --- a/aspnetcore/signalr/hubcontext.md +++ b/aspnetcore/signalr/hubcontext.md @@ -40,9 +40,8 @@ Access the `IHubContext` within the middleware pipeline like so: ```csharp app.Use(next => (context) => { - var hubContext = (IHubContext)context - .RequestServices - .GetServices>(); + var hubContext = context.RequestServices + .GetRequiredService>(); //... }); ```