-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Question on stackoverflow
I have a 2.2 .net core application, using SignalR core, in one of my Controllers I want to inject IHubContext<ChatHub, IChatClient>. Works pretty well with built-in IoC, but when I add Grace IoC I get the following error message:
Unable to resolve service for type 'Microsoft.AspNetCore.SignalR.IHubContext`2[Test.Hubs.ChatHub,Test.Hubs.IChatClient]' while attempting to activate TestController
I tried to add the following line in the ConfigureContainer method:
scope.Configure(c=> c.Export<IHubContext<ChatHub, IChatClient>>());Also tried:
scope.Configure(c=> { c.Export(typeof(IHubContext<,>)); });Then the error changed to the following which sounds reasonable since I haven't registered a concrete class for the interface.
Could not find public constructor on type Microsoft.AspNetCore.SignalR.IHubContext`2[[Test.Hubs.ChatHub, Test, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null],[Test.Hubs.IChatClient, Test, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null]]And BTW, I've tested aforementioned approaches with both
.UseGrace((new InjectionScopeConfiguration { AutoRegisterUnknown = true })) and .UseGrace((new InjectionScopeConfiguration { AutoRegisterUnknown = false })).
Grace.AspNetCore.MVC and Grace.AspNetCore.Hosting packages are installed.
Anything that I missed?