I'm using role based security in a WCF application. I've decorated my service operation implementation with the System.Security.Permissions.PrincipalPermissionAttribute.
If the authorization fails then a System.Security.SecurityException gets raised (which contains the role which was asserted).
I'd like to log the details of the System.Security.SecurityException. However, if I implement an IErrorHandler I don't get the original System.Security.SecurityException passed to the HandleError or ProvideFault methods, I get a System.ServiceModel.FaultException instead. This latter exception doesn't include any of the details I want to log.
Is there any way to get the original System.Security.SecurityException from within the IErrorHandler, or is there another hook somewhere in WCF to get hold of it?
Been hunting around and according to Microsoft:
WCF filters it out, so no you can't get at the original exception.