I'm using Microsoft.AspNetCore.SignalR (1.1.0)
I have some services in startup.cs
:
services.AddSingleton<IHostedService, MySingletonService>();
services.AddScoped<MyScopedService >();
Now I want to use this service in my hub, so I inject it:
private readonly MyScopedService _cs;
private readonly MySingletonService _ss;
public MyHub(MyScopedService cs, MySingletonService ss)
{
_cs = cs;
_ss= ss;
}
This works only for the scoped service, as soon as the service is singleton the hub never gets called and cannot connect in the browser. Why is this not possible? I just want the existing instance of the singleton service, call a method and then let it go again.