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 937725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:31:25+00:00 2026-05-15T21:31:25+00:00

I need to find a way to put my MVC controllers into a different

  • 0

I need to find a way to put my MVC controllers into a different project from the MVC project.

I think I’m close. I’ve setup the Castle Windsor IoC container, and have my controllers in a different project. I think it’s hanging up on the Web.Config. Is there a component I need to add? Here is the current exception I’m getting:

No component for supporting the
service
MySolution.Express.Controllers.HomeController
was found

Here is my code:

Web.Config portion that pertains to Castle Windsor

<section name="castle"
             type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,
             Castle.Windsor" />
  </configSections>

   (....)
<castle>
    <components>

    </components>
  </castle>

Global.ascx

public static void RegisterRoutes(RouteCollection routes)
    {
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

      routes.MapRoute(
          "Default", // Route name
          "{controller}/{action}/{id}", // URL with parameters
          new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
      );

    }

    protected void Application_Start()
    {
      AreaRegistration.RegisterAllAreas();

      RegisterRoutes(RouteTable.Routes);
      ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory());
      ControllerBuilder.Current.DefaultNamespaces.Add("MyProject.Express.Controllers");
    }

WindsorControllerFactory.cs

 WindsorContainer container;

public WindsorControllerFactory()
{
  container = new WindsorContainer(
                   new XmlInterpreter(new ConfigResource("castle"))
               );
  var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes()
                         where typeof(IController).IsAssignableFrom(t)
                         select t;
   foreach (Type t in controllerTypes)
     container.AddComponentWithLifestyle(t.FullName,t,
                                         LifestyleType.Transient); 
 }

protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
 {
   return (IController)container.Resolve(controllerType);
 }
  • Is there a component I need to add?
  • What else can I do to achieve this goal?
  • 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-05-15T21:31:26+00:00Added an answer on May 15, 2026 at 9:31 pm

    The code you are using to register the controllers is looking at the executing assembly so it won’t find the controllers. As you’ve found out one solution is to explicitly register the controllers.

    Alternatively, if you use MvcContrib.Castle then you can replace the second line of code in your WindsorControllerFactory constructor with something like this to register all controllers from the controller assembly:

    container.RegisterControllers(typeof(HomeController).Assembly);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to find a way to hide HTML Rows (or Tables) from view
I need a Java way to find a running Win process from which I
I need to find a way to crawl one of our company's web applications
I need to find a way to get at the request/response streams inside of
I need to find a way to monitor the status of a list of
I need to find a fairly efficient way to detect syllables in a word.
I need a quick way to find out if a given port is open
I need to find a way to store 250 KB of plain text numbers
I am rewriting our company website in cakephp, and need to find a way
Howdy! For a research project (in Java), I've got to find some way to

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.