Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8575589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:43:42+00:00 2026-06-11T19:43:42+00:00

I am unable to configure Windsor Container with asp.net web api, though it working

  • 0

I am unable to configure Windsor Container with asp.net web api, though it working fine with regular controller(IController).

I have regular controller and api controller in same project.

Here is the code for regular controller which working fine:

/// <summary>
    /// Controller Factory class for instantiating controllers using the Windsor IoC container.
    /// </summary>
    public class WindsorControllerActivator : IControllerActivator
    {
        private readonly IWindsorContainer container;
        public WindsorControllerActivator(IWindsorContainer container)
        {
            this.container = container;
        }
        public IController Create(RequestContext requestContext, Type controllerType)
        {
            var controller = (IController)container.GetService(controllerType);
            return controller;
        }

}

and in global.asax.cs

 container.Register(Component.For<IWindsorContainer>().Instance(container));
  container.Register(Component.For<IControllerActivator>().ImplementedBy<WindsorControllerActivator>());

and below is the problematic code:

public class WindsorApiControllerActivator : IHttpControllerActivator 
    {
        private readonly IWindsorContainer container;
        public WindsorApiControllerActivator(IWindsorContainer container)
        {
            this.container = container;
        }
        public IHttpController Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)
        {
            var controller = (IHttpController)container.GetService(controllerType);
            return controller;
        }
    }

and installer:

 container.Register(Component.For<IHttpControllerActivator>().ImplementedBy<WindsorApiControllerActivator>());

however, i am never able to execute WindsorApiControllerActivator.

when, i put debugger in WindsorControllerActivator it work as expected, but for WindsorApiControllerActivator it never get executed.

your help will be appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:43:43+00:00Added an answer on June 11, 2026 at 7:43 pm

    I added the following code in global.asax.cs, and it works:)

     _windsorContainer = new WindsorContainer();
        _windsorContainer.Install(new EventSorbetInstaller());
        DependencyResolver.SetResolver(new WindsorDependencyResolver(_windsorContainer));
       ServiceLocator.SetLocatorProvider(() => new WindsorServiceLocator(_windsorContainer));
       RegisterFilterProviders(FilterProviders.Providers, _windsorContainer);
    
      var activator = _windsorContainer.Resolve<IHttpControllerActivator>();
    
       GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerActivator), activator);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using ASP.NET + a MySql Db. I'm trying to configure a ListView so
i'm totally confused about configure asp.net website to send email - hope you can
I have a couple of personal web-based projects in the pipeline, and am unable
I configured proxy server.Before I configure proxy mail clients works fine.Now I am unable
I am unable to change my max execution time. I have changed it in
I am trying to configure maven 3.0.3 for windows 7. I have it on
I have an issue where I am unable to access a recently imported SVN
I downloaded the php_printer extension from http://downloads.php.net/pierre/ . But when i try to configure
I am trying to configure an ErrorController in my .NET MVC application, and I
I am attempting to configure a regular expression that matches anything numerical value but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.