2

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?

Daniel James Bryars
  • 4,429
  • 3
  • 39
  • 57

1 Answers1

1

Been hunting around and according to Microsoft:

http://connect.microsoft.com/VisualStudio/feedback/details/371181/wcf-ierrorhandler-logging-securityexceptions

WCF filters it out, so no you can't get at the original exception.

Daniel James Bryars
  • 4,429
  • 3
  • 39
  • 57
  • The link no longer points to the original content. Unfortunately, I wasn't able to find it anywhere, so I can update it. – Cosmin Vană Sep 07 '18 at 07:30