/// <summary> /// /// </summary> /// <param name="instanceContext"></param> /// <param name="message"></param> /// <returns></returns> public object GetInstance(System.ServiceModel.InstanceContext instanceContext, System.ServiceModel.Channels.Message message) { Type type = instanceContext.Host.Description.ServiceType; if (type == null) { throw new InvalidOperationException(); } ComponentManager.Configure(); var container = ComponentManager.GetContainer(); container.Register(type, ifAlreadyRegistered: IfAlreadyRegistered.Keep); container.Intercept <ServiceOperationAspect>(type); this.ServiceInstance = container.Resolve(type); RunWorkersThreads(); return(this.ServiceInstance); }