I have a bunch of WCF SOAP services that in the service host configure a ServiceCredentials behavior to use System.IdentityModel to validate an incoming claims token.
The same service host configures an IErrorHandler to catch any exceptions being thrown in the service. This FaultHandler gets attached to every channel dispatcher in the service.
The issue is that the System.IdentityModel token validation code is throwing an System.SecurityException
when it detects an invalid token, but this exception is not caught by the FaultHandler (and therefore not logged).
Why are these exception not caught by the IErrorHandler? And how can I make sure these exceptions are logged?
This answer points to the same problem, but does not hint at a solution.
This comment indicates that it is expected, but I don't understand why that is.