Setting up Castle Windsor IoC (Inversion of Control) aka Dependency Injection

it can be a bit confusing getting this thing running

Dependency Injection is the new big thing, and I am late on that bandwagon. But I recently began using Castle Windsor while learning ASP.NET MVC through reading Pro ASP.NET MVC Framework which is a fantastic book.

Anyway, setup can be a little pain to go through, and is no longer exactly as written out by the book, so here is a quick and simple guide:


  • Visit the Project Page and look for the MicroKernel/Windsor project, download the latest stable version (it was 2.0.0 while writing this).
  • Copy the dlls to your bin or register them in your GAC.
  • Reference the following libraries:
    • Castle.Core
    • Castle.DynamicProxy2
    • Castle.MicroKernel
    • Castle.Windsor

alter your web.config

Add in the following inside the <configSections$gt;

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

Add this right before your <system.web>


that's it

That's all it takes, your Castle Windsor should now be running.
Comments are closed