Interception for WCF class of service?

I have a client and server application that communicates using WCF. To add some sort of user session information to each WCF message header, I wrapped the WCF client channel in the ClientChannelProxy class and used the Unity Interception extension to add my own header information using aspects.

IUnityContainer container = new UnityContainer();
container.AddNewExtension<Interception>();
container.RegisterType<IClientService, ClientServiceProxy>();
container.Configure<Interception>().SetInterceptorFor<IClientService>(new
TransparentProxyInterceptor());

This works great for the client, as I can easily configure the unity container and interception using the code shown above.

But how to configure unity and interception on the server side? My WCF service is configured in a .SVC file, I have no way to configure the interception and execute my aspects.

<%@ ServiceHost Language="C#" Debug="true" Service="Test.ClientService" %>
<!-- How to configure Unity Interception for this WCF-Service ? -->

It would not be nice if someone could help me get it to work. Thank!

+5

All Articles