public void Process(PipelineArgs args)
        {
            IWindsorContainer container = this.BuildContainerAndRegisterTypes();

            // create the chained resolvers using our own resolvers then falling back to whatever was previously set.
            // MVC
            IMVCDependencyResolver chainedMVCResolver = new ChainedMvcResolver(new WindsorMvcDependencyResolver(container),
                                                                               System.Web.Mvc.DependencyResolver.Current);
            System.Web.Mvc.DependencyResolver.SetResolver(chainedMVCResolver);

            //WebAPI
            IWebAPIDependencyResolver chainedWebAPIResolver = new ChainedWebApiResolver(new WindsorWebApiDependencyResolver(container),
                                                                                GlobalConfiguration.Configuration.DependencyResolver);
            System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver = chainedWebAPIResolver;

            // Optional use of Controller Factories (for both Mvc and WebApi)
            this.SetupMvcControllerFactory(DependencyResolver.Current);
            //this.SetupWebApiControllerActivator(GlobalConfiguration.Configuration.DependencyResolver, container);
        }
        public void Process(PipelineArgs args)
        {
            var autofacContainerFactory = new AutofacContainerFactory();

            var container = autofacContainerFactory.Create();

            if (container != null)
            {
                // MVC Resolver
                IDependencyResolver chainedMvcResolver = new ChainedMvcResolver(
                    new AutofacDependencyResolver(container),
                    DependencyResolver.Current);
                DependencyResolver.SetResolver(chainedMvcResolver);

                // WebAPI Resolver
                System.Web.Http.Dependencies.IDependencyResolver chainedWebApiResolver =
                    new ChainedWebApiResolver(new AutofacWebApiDependencyResolver(container),
                        GlobalConfiguration.Configuration.DependencyResolver);
                GlobalConfiguration.Configuration.DependencyResolver = chainedWebApiResolver;

                // MVC Controller Factory
                ControllerBuilder.Current.SetControllerFactory(new AutofacControllerFactory(container));
            }
        }