From dd507467f99d7a86811658e37c805e8120c9de48 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Mon, 10 Sep 2018 07:28:11 -0700 Subject: [PATCH] Fixed code sample (#8475) Fixed code to retrieve the IHubContext from middleware --- aspnetcore/signalr/hubcontext.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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>(); //... }); ```