I have deployed my service and attached Visual Studio to the process to debug in one Visual Studio instance, and in another I have a client console test application that I run in debug mode, I can see both service methods that I call executed in the debugger, but in the second one where I throw an exception on purpose, I never see the code in ErrorHandlerBehavior called at all. Is my registration for ErrorHandlerBehavior not correct?
I wonder if I need to have a behaviour extension in my service configuration for this?
I based my global exception handling off of the this example
Here is my container registration in my service program main method:
container.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero);
container
.Register(Component.For<WcfProtoType.IServiceProtoType>()
.ImplementedBy<WcfProtoType.ProtoTypeService>()
.Named("ProtoTypeService")
.AsWcfService( new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new BasicHttpBinding(BasicHttpSecurityMode.None))
.At(baseUrl)
).PublishMetadata(o => o.EnableHttpGet())),Component.For<ServiceBase>().ImplementedBy<MyService>(),
Component.For<ErrorHandlerBehavior>().Attribute("scope").Eq(WcfExtensionScope.Services));
I looked at the Castle Windsor source and from what I can tell the EndPointBehavior needs to be registered first like this:
container
.Register(Component.For<ErrorHandlerBehavior>().Attribute("scope").Eq(WcfExtensionScope.Services),
Component.For<WcfProtoType.IServiceProtoType>()
.ImplementedBy<WcfProtoType.ProtoTypeService>()
.Named("ProtoTypeService")
.AsWcfService( new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new BasicHttpBinding(BasicHttpSecurityMode.None))
.At(baseUrl)
).PublishMetadata(o => o.EnableHttpGet())),Component.For<ServiceBase>().ImplementedBy<MyService>());