I'm of the mindset that absolutely every programmer should have read Mark Seeman's Dependency  Injection in .NET.  Or at the very least, the free Chapter 4 excerpt (the best chapter!)

Perhaps then, I could do a search for resolving dependencies in SignalR clients (such as a hub) without being bombarded with the blight that is IDependencyResolver. Though it looks like they've done a bit of work on it since MVC3 (what the book was written for) - adding lifetime scopes and disposal - it's still not really enough. The IDependencyScope interface lacks the ability to specify child scopes. You want 3 levels (say, application, session, request)?  Too bad.

To set the record straight, the proper way to do it for MVC is by replacing the implementation of the controller factory with your own dependency resolving one. Observe something like this:

public class DependencyResolvingControllerFactory : DefaultControllerFactory
    private readonly IContainer _container;

    private readonly Dictionary<IController, ILifetimeScope> _scopesForControllers = new Dictionary<IController, ILifetimeScope>();

    public DependencyResolvingControllerFactory(IContainer container)
        _container = container;

    protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
        ILifetimeScope scope = _container.BeginLifetimeScope();
        IController controller = (IController)scope.Resolve(controllerType);
        _scopesForControllers[controller] = scope;

        return controller;

    public override void ReleaseController(IController controller)
        ILifetimeScope scope = _scopesForControllers[controller];


and override the default inside Application_Start

ContainerBuilder containerBuilder = new ContainerBuilder();
IContainer container = containerBuilder.Build();
ControllerBuilder.Current.SetControllerFactory(new DependencyResolvingControllerFactory(container));

Cut down to bare minimum for brevity. Substitute your own container in as necessary.

If you're not in MVC Land, and you need to do it with the ASP.NET Web API, Mark Seeman has the solution, as always.