PDA

View Full Version : IHttpHandlerFactory AopProxy


Nicoláz
07-10-2006, 04:05 AM
Hi, I'm trying to create a and AopProxy my implementation of IHttpHandler, and I getting the following message:

Type 'Spring.Aop.DynamicProxy.Proxy_19b2a3c9bfb84b9fb69 a6f293be6a401' from assembly 'Spring.Aop.DynamicProxy, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.


When I debug, I find that the proxyfactory is trying to make the proxy to implement IhttpHandlerFactory and IHttpHandlerFactory2. I looked for this second interface in the asp.net documentation but I couldn't find anything.

any idea?

regards,
Nicolaz

Bruno Baia
07-10-2006, 09:15 PM
Hi Nicolaz,

The IHttpHandlerFactory2 is an internal interface from System.Web.dll.
You can't proxy an inaccessible interface (internal, private, ...) because the dynamic proxy can't reference it.

What you can do is to set explicity interfaces you want to proxy :

<object id="MyHttpHandlerFactoryProxied" type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
<property name="TargetName" value="MyHttpHandlerFactory"/>
<property name="InterceptorNames">
<list>
<value>DebugAdvice</value>
</list>
</property>
<property name="Interfaces">
<list>
<value>System.Web.IHttpHandlerFactory, System.Web</value>
</list>
</property>
</object>

doing this, it will not try to implement IHttpHandlerFactory2.

-Bruno