.net 4.0 - How can I create a DynamicProxy for a WCF proxy that is generated by ChannelFactory<T>? -
I am using ChannelFactory to create a proxy for run-time WCF service. I would like to use the dynamic proxy castle project to create a dynamic proxy at the top of the WCF proxy so that I can stop and impersonate a call.
When I try this then I am getting an error. The error message is:
'This' type can not be the interface itself.
My code is this (where t is a service contract interface):
var generator = new proxy generator (); Return (t) generator. Creating interfaces with ProxyPix target (Typef (T), Channel, New [] (New Impersonation Interceptor ()}; The problem must be addressed by the fact that the generated service generated by ChannelFactory is generated on proxy runtime Is there any way around this problem?
Yes - there is - WCF feature Use it, replacing the WCF proxy with the Castle's dynamic proxy.
The problem here is that you Trying to create a proxy at the top of a proxy, and the remote proxy has some specific specific behavior, which results in the error you are receiving.
Comments
Post a Comment