Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 Areas problem
    text
    copied!<p>I am building an application with MVC3 and I have a problem when I want to add an area.</p> <p>I am adding a UsersArea everything works fine but when I try to run the Web Site I get the following error :</p> <p>No component for key userscontroller was found</p> <p>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p> <p>Exception Details: Castle.MicroKernel.ComponentNotFoundException: No component for key userscontroller was found</p> <p>Source Error: </p> <p>Line 160: public IController CreateController(RequestContext context, string controllerName) Line 161: { Line 162: return IoC.Resolve((controllerName + "Controller").ToLower()); Line 163: } Line 164:</p> <p>Here is my Windsor code :</p> <pre><code> protected override IWindsorContainer CreateContainer(string windsorConfig) { IWindsorContainer container = new WindsorContainer(); container.Register(Component.For&lt;IUnitOfWorkFactory&gt;() .ImplementedBy&lt;NHibernateUnitOfWorkFactory&gt;()); container.Register(Component.For&lt;IProductRepository&gt;() .ImplementedBy&lt;ProductRepository&gt;() .LifeStyle.Is(LifestyleType.Transient)); container.Register(Component.For&lt;ICustomerService&gt;() .ImplementedBy&lt;CustomerService&gt;() .LifeStyle.Is(LifestyleType.Transient)); container.Register(Component.For&lt;ICustomerRepository&gt;() .ImplementedBy&lt;CustomerRepository&gt;() .LifeStyle.Is(LifestyleType.Transient)); container.Register(Component.For&lt;ICategoryRepository&gt;() .ImplementedBy&lt;CategoryRepository&gt;() .LifeStyle.Is(LifestyleType.Transient)); container.Register(Component.For&lt;IOrderRepository&gt;() .ImplementedBy&lt;OrderRepository&gt;() .LifeStyle.Is(LifestyleType.Transient)); container.Register(Component.For&lt;ILogger&gt;() .ImplementedBy&lt;NLogLogger&gt;() .LifeStyle.Is(LifestyleType.Transient)); container.Register(AllTypes.Of&lt;IController&gt;() .FromAssembly(typeof(HomeController).Assembly) .Configure(t =&gt; t.Named(t.Implementation.Name.ToLower()) .LifeStyle.Is(LifestyleType.Transient))); return container; } public class RhinoIoCControllerFactory : IControllerFactory { public IController CreateController(RequestContext context, string controllerName) { return IoC.Resolve&lt;IController&gt;((controllerName + "Controller").ToLower()); } public void ReleaseController(IController controller) { IoC.Container.Release(controller); } public SessionStateBehavior GetControllerSessionBehavior(RequestContext requestContext, string controllerName) { return SessionStateBehavior.Default; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload