I implemented a console app that uses DynamicInterception on structure map, I follow the example on the page StructureMap DynamicInterception. Now I'm trying to pass the code to a asp.net MVC site but I get the following error
Decorator Interceptor failed during object construction. See the inner exception:
1.) DynamicProxyInterceptor of ITSector.Site.Core.Controllers.HomeController with interception behaviors: ITSector.Library.Aspect.LoggerInterceptor 2.) ITSector.Site.Core.Controllers.HomeController 3.) Instance of ITSector.Site.Core.Controllers.HomeController 4.) Container.GetInstance(ITSector.Site.Core.Controllers.HomeController)
The inner exception is: Specified type is not an interface Parameter name: interfaceToProxy With the stacktrace:
at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, Object target, ProxyGenerationOptions options, IInterceptor[] interceptors)
at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithTarget[TInterface](TInterface target, IInterceptor[] interceptors)
at lambda_method(Closure , IBuildSession , IContext )
I use the Structure.MVC5.Update nuget as the Dependency Resolver. Can anyone give me any hint on how to implement it to intercept calls on controller methods.
Thanks.