Autofac using DynamicProxy2 interception with WcfIntegration

I am trying to connect a service interface using WcfIntegration with IInterceptor.

The startup documentation has examples for each, but nothing that combines the two.

Here is the documentation for WcfIntegration and see the DynamicProxy2 documentation here .

Has anyone successfully hooked up an interceptor with WcfIntegration using Autofac?

Example code that I expected to work:

            builder.Register(c => new CacheInterceptor())
            .Named<IInterceptor>("cache-calls");

        builder
            .RegisterType<ChannelFactory<IEnquiryService>>()
            .AsSelf()
            .WithParameter(new NamedParameter("endpointConfigurationName", "EnquiryService"))
            .SingleInstance();

        builder
            .Register(c => c.Resolve<ChannelFactory<IEnquiryService>>().CreateChannel())
            .As<IEnquiryService>()
            .EnableInterfaceInterceptors()
            .InterceptedBy("cache-calls");

EDIT:

It seems that the error was reported on the autofac site. Any work for this?

+3
source share
1 answer

All Articles