As it turns out, after spending the afternoon debugging the Autofac WCF implementation, it does indeed create a new Lifetime scope for every instance that is served up, so basically every WCF service host instance gets all new dependencies for every service call, which mimics request scoping for
ASP.NET web requests. So yes, in fact if I set all my service classes to use InstancePerLifetimeScope() then every WCF request and every HTTP request gets all new instances of all my classes that are marked that way.
Now that I understand how this works I plan to re-write my WCF code to use Autofac, but it dawned on me while implementing all of this that the use of the InstancePerHttpRequest() function which basically requires a scope with the tag named 'AutofacWebRequest' pretty much won't allow that code to be shared with anything in the WCF service stack. And in fact using InstancePerHttpRequest() is not even needed at all, because using InstancePerLifetimeScope() already ensures that every HTTP request gets separate instances anyway.
So now I am wondering why you would ever use InstancePerHttpRequest() for
ASP.NET code?
- Kendall