I'm using NET Core 2.1 and have Ninject as my DI and I'm trying to inject IHubContext inside a controller constructor using ninject, but getting this error:
"Ninject.ActivationException: 'Error activating IHubContext No matching bindings are available, and the type is not self-bindable."
I've added SignalR to services (services.AddSignalR()) and mapped it for the IApplicationBuilder: app.UseSignalR(route => route.MapHub("/myhub"));
Tried binding it from the global resolver also: kernel.Bind< IHubContext>().ToMethod(context => GlobalHost.DependencyResolver.Resolve< IHubContext>()).InSingletonScope(); but with no luck, what I am missing in order to inject this IHubContext in the constructor of my controller using Ninject.
Thank you.
IHubContext<THub>
. I'm assuming yourMapHub
is actuallyMapHub<HubType>
, you should useHubType
withIHubContext<>
- Brennan