A request sent to a WCF service, which calls
IBus.SendLocal creates two instances of an object configured as
Autofac.Integration.WCF (which makes everything resolve 'per request', by providing a new child scope to each WCF request)
IBus.SendLocal invokes a message mutator, which gets injected with the same resource type as the wcf service
However, two different instances get created. One is injected into the service, a different instance is injected into the message mutator.
I'm assuming, this is because NSB creates its own child scope that's based on the root container.
Any ideas/pointers how to resolve this issue (ie have only a single instance created per WCF request)?
Edit: using NSB 4.3.2 and Autofac 3.5.2
Simplified configuration code
Autofac.IContainer container = ConfigureIoc(); Configure .With(AllAssemblies.Matching("this.dll").And("that.dll")) .DefineEndpointName("endpoint name here") .AutofacBuilder(container) .MsmqSubscriptionStorage() .UnicastBus() .CreateBus() .Start(); ServiceHost host = CreateHost(); host.AddDependencyInjectionBehavior(typeof(ISomeContract), container); host.Open();