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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:44:13+00:00 2026-05-14T03:44:13+00:00

I am using Castle Windsor for IoC, and have the configuration held in the

  • 0

I am using Castle Windsor for IoC, and have the configuration held in the web.config/app.config, using the following factory:

public static TYPE Factory(string component)
    {
        var windsorContainer = new WindsorContainer(new XmlInterpreter());
        var service = windsorContainer.Resolve<TYPE>(component);

        if (service == null)
            throw new ArgumentNullException(string.Format("Unable to find container {0}", component));

        return service;
    }

and my web.config looking like this:

<configuration>
  <configSections>
    <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>
  </configSections>
  <castle>
    <components>
      <component id="Data" service="Data.IData, Data" type="Data.DataService, Data"/>
    </components>
  </castle>
  <appSettings>.......

Which works fine, but I’d like to place the configuration for Castle Windsor in a file called castle.config. How do I do this?

  • 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-14T03:44:13+00:00Added an answer on May 14, 2026 at 3:44 am

    WindsorContainer will accept the name of the configuration file as a construction parameter:

    public WindsorContainer(string xmlFile)

    Summary: Initializes a new instance of
    the Castle.Windsor.WindsorContainer
    class using a xml file to configure
    it. Equivalent to the use of new
    WindsorContainer(new
    XmlInterpreter(xmlFile))

    Your castle.config file would then look like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <components> ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Castle Windsor with a configuration from my App.config file. In the code
Using Castle Windsor as my IoC container and NHibernate I have the following registration:
I'm using Castle Windsor, and I've got the following: public class NhibernateRepository<T> : IRepository<T>
Using Castle Windsor, I want to configure a generic service with a type parameter;
I am using a custom ControllerFactory (to use Castle Windsor's IOC to create controllers),
I'm using Castle Windsor 3.0 for dependency injection in a demo ASP.NET app. One
I am using Castle Windsor for IoC and I want to use Binsor to
Issue I am using Castle Windsor as an IoC container in a Castle Monorail
In my case I am using Castle Windsor as my IoC container. I would
I am using windsor castle as my IoC container, and has run in 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.