/// <summary> /// 重写以实现设置SignalR框架的DependencyResolver /// </summary> /// <param name="assemblies"></param> protected override void SetResolver(Assembly[] assemblies) { ContainerBuilder builder = new ContainerBuilder(); builder.RegisterHubs(assemblies).AsSelf().PropertiesAutowired(); builder.Update(Container); IDependencyResolver resolver = new global::Autofac.Integration.SignalR.AutofacDependencyResolver(Container); GlobalHost.DependencyResolver = resolver; }