I am developing a set of services using WCF. The app injects dependencies with Castle Windsor. I added an IErrorHandler implementation added to services through an attribute. Everything is still working. IErrorHandler object (of a class named FaultHandler is applied correctly and called.
Now I am adding a magazine. Castle Windsor is configured to enter a registration object (instance of IOurLogger ). It works. But when I try to add it to FaultHandler , my logger is null.
The FaultHandler code looks something like this:
class FaultHandler : IErrorHandler { public IOurLogger logger { get; set; } public bool HandleError(Exception error) { logger.Write("Exception type {0}. Message: {1}", error.GetType(), error.Message);
This throws its own exception, since logger is null when HandleError() called.
The registrar is successfully entered into the service itself and can be used there, but for some reason I cannot use it in FaultHandler .
Refresh . Here is the relevant part of the Windsor configuration file (edited to protect the innocent):
<configuration> <components> <component id="Logger" service="Our.Namespace.IOurLogger, Our.Namespace" type="Our.Namespace.OurLogger, Our.Namespace" /> </components> </configuration>
source share