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

  • SEARCH
  • Home
  • 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 8905773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:28:44+00:00 2026-06-15T02:28:44+00:00

So, i used Mark Seemann’s example to do dependency injection with Windsor in MVC

  • 0

So, i used Mark Seemann’s example to do dependency injection with Windsor in MVC 4 RC Web Api, but i get an exception saying that it can’t resolve the dependencies to my ApiController

public class StatisticsController : ApiController
{
    private readonly ILogger _logger;
    private readonly IClickMessageProducer _producer;

    public StatisticsController(ILogger logger, 
        IClickMessageProducer clickMsgProducer)
    {
        _logger = logger;
        _producer = clickMsgProducer;
    }

    public string Get(string msg, string con) {...}
}

My Global.asax looks like this:

protected void Application_Start()
    {
        // different configs removed for brevity

        BootstrapContainer();
    }

    private static IWindsorContainer _container;

    private static void BootstrapContainer()
    {
        _container = new WindsorContainer()
            .Install(FromAssembly.This(), new ProducerInstaller())
            .Install(FromAssembly.This(), new WebWindsorInstaller());

        GlobalConfiguration.Configuration.Services.Replace(
            typeof(IHttpControllerActivator),
            new WindsorHttpControllerActivator(_container));
    }

The Installers gives Windsor the references needed to IClickMessageProducer. I have it working with IController in a genuine MVC 4 project so i’m confident that part is working.

To specify, this is the error message i get, when trying to access a method in StatisticsController with a GET call to the API:

<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
    Can't create component 'APIMVC.Controllers.StatisticsController'
    as it has dependencies to be satisfied. 
    'APIMVC.Controllers.StatisticsController' is waiting for the following 
    dependencies: - Service 'Castle.Core.Logging.ILogger' which was not registered.
</ExceptionMessage>
<ExceptionType>Castle.MicroKernel.Handlers.HandlerException</ExceptionType>
<StackTrace>...</StackTrace>
</Error>

The call being something like this:
“http://localhost:60000/api/statistics?msg=apitest&con=apimvc&#8221;

If anyone has a working example or just a comment to the problem about my Windsor implementation i’ll be happy to see it.

  • 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-15T02:28:45+00:00Added an answer on June 15, 2026 at 2:28 am

    _container = new WindsorContainer().Install(FromAssembly.This(), new ProducerInstaller()).Install(FromAssembly.This(), new WebWindsorInstaller());

    this was the part at fault. As you can see I call Install(FromAssembly.This()) twice witch caused the LoggerInstaller to try to add a LoggingFacilitytwice causing an error.

    The new implementation would look like this:
    _container = new WindsorContainer().Install(FromAssembly.This(), new ProducerInstaller(), new WebWindsorInstaller());

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Mark Seemann's book Dependency Injection in .NET , he states that more people
In the social network movie i saw Mark used Elo rating system But was
This is the code I used to get array key with single quote mark:
I used chr(252) for tick mark in crystal report, this tick mark displayed in
In NUnit, the TestFixtureSetup attribute can be used to mark a method which should
I am using Sass 3.2.1 (Media Mark), and used --watch main.scss:main.css --style compact for
Possible Duplicate: What is a Question Mark ? and Colon : Operator Used for?
Has anyone here used Mark Story's Asset Compress (https://github.com/markstory/asset_compress/) plugin ? I've followed the
The HTML5 element abbr is used to mark-up abbrevations and acronyms. Unfortunately, the spec
This used to be real easy in 2010, but now I can't even find

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.