I've just installed ELMAH MVC (v2) into my web application but when I try to view the logs at /elmah I get the following exception
No component for supporting the service Elmah.Mvc.ElmahController was found [ComponentNotFoundException: No component for supporting the service Elmah.Mvc.ElmahController was found] Castle.MicroKernel.DefaultKernel.Resolve(Type service) +140 Castle.Windsor.WindsorContainer.Resolve(Type service) +40 N2.Engine.Castle.WindsorServiceContainer.Resolve(Type type) +40 N2.Engine.ContentEngine.Resolve(Type serviceType) +48
The web site includes the N2 CMS system which in turn uses Castle Windsor.
Any ideas on how I can resolve this?
I know this already has an accepted answer, and it's not entirely relevant to your question, but for anyone else not using N2 and running into issues with Elmah.MVC+Castle Windsor, you need to register the controllers in the Elmah.MVC assembly with Windsor. I made a simple installer to handle this for me:
public class ElamhInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Classes.FromAssemblyNamed("Elmah.Mvc")
.BasedOn<IController>()
.LifestyleTransient());
}
}
Once I added this Castle seems to be able to find the ElmahController
just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With