ELMAH MVC 2 - Problem with Windsor Lock

I just installed ELMAH MVC (v2) in my web application, but when I try to view the logs in / elmah, I get the following exception

No components to support the Elmah.Mvc.ElmahController service were found [ComponentNotFoundException: a component to support the Elmah.Mvc.ElmahController service was not found] Castle.MicroKernel.DefaultKernel.Resolve (Service type) +140 Castle.Windsor.WindsorContainer.Resolve (type of service ) +40 N2.Engine.Castle.WindsorServiceContainer.Resolve (Type Type) +40 N2.Engine.ContentEngine.Resolve (Type serviceType) +48

The website includes an N2 CMS system, which in turn uses Castle Windsor.

Any ideas on how I can solve this?

+7
source share
3 answers

Developed a solution shortly after posting the question. I needed to register an Elmah controller using N2:

var engine = MvcEngine.Create(); engine.RegisterControllers(typeof(GlobalApplication).Assembly); engine.RegisterControllers(typeof(ElmahController).Assembly); 
0
source

I know that this already has an accepted answer, and this does not entirely apply to your question, but for someone else not using N2 and running into problems with Elmah.MVC + Castle Windsor, you need to register the controllers in the Elmah assembly . MVC using 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 that this castle seems to be able to easily find the ElmahController .

+15
source

ELMAH.MVC ships with the App_Start code, which uses Web.Activator to register the ElmahController route.

So, this is strange to me why Windor cannot load the ElmahController. By default, it should try to solve this on its own, and then, if this is not possible, delegate ControllerFactory.

Are you sure the application was restarted (iisreset.exe) after installing ELMAH?

0
source

All Articles