How do I get Autofac to inject dependencies into the signalr hubs, I have tried all the only questions many of which are now out of date, I have tried the signalr.autofac download from their site, but nothing seems to work?
My Autofac
var builder = new ContainerBuilder();
builder.RegisterControllers(typeof(MvcApplication).Assembly);
//Register Context
builder.Register(c => new myContext()).As<IUnitOfWork>().InstancePerLifetimeScope();
//Repositories
builder.RegisterGeneric(typeof(BaseRepository<>)).As(typeof(IBaseRepository<>)).InstancePerHttpRequest();
//Service Layer
builder.RegisterType<UserService>().As<IUserService>().InstancePerHttpRequest();
//other services etc
builder.RegisterType<ChatHub>();
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
GlobalHost.DependencyResolver = new Autofac.Integration.SignalR.AutofacDependencyResolver(container);
RouteTable.Routes.MapHubs();
The dependency revolver I get from the autofac web site;
http://code.google.com/p/autofac/downloads/detail?name=Autofac.SignalR.3.0.0.zip
but I get;
No scope with a Tag matching 'AutofacWebRequest' is visible from the scope in which the instance was requested. This generally indicates that a component registered as per-HTTP request is being requested by a SingleInstance() component (or a similar scenario.) Under the web integration always request dependencies from the DependencyResolver.Current or ILifetimeScopeProvider.RequestLifetime, never from the container itself.