SignalR GlobalHost and DependencyResolver
TL;DR
When you register dependency resolver with SignalR server, avoid using GlobalHost
to retrieve instances of hubs.
Tracing SignalR server
What helped me actually to figure it out was tracing information. Like explained here, to get the info into Visual Studio debug console, add the following into .config
file of application:
Once I added those, each time I accessed GlobalHost
the following was printed:
1
2
3
SignalR.ReflectedHubDescriptorProvider Warning: 0 : Some of the classes from assembly "Microsoft.AspNet.SignalR.Owin, Version=1.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" could Not be loaded when searching for Hubs.
Original exception type: ReflectionTypeLoadException
Original exception message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
This message made me think that probably if I have resolver registered, no assembly scanning should take place.
The fix
In application start configure SignalR with resolver:
And much later in application: