如何在IErrorHandler中获取原始Exception
我在 WCF 应用程序中使用基于角色的安全性。我已经使用 System.Security.Permissions.PrincipalPermissionAttribute 装饰了我的服务操作实现。
如果授权失败,则会引发 System.Security.SecurityException(其中包含已断言的角色)。
我想记录 System.Security.SecurityException 的详细信息。但是,如果我实现 IErrorHandler,则不会将原始 System.Security.SecurityException 传递给 HandleError 或 ProvideFault 方法,而是得到 System.ServiceModel.FaultException。后一个异常不包括我想要记录的任何详细信息。
有没有办法从 IErrorHandler 中获取原始的 System.Security.SecurityException,或者 WCF 中是否有另一个挂钩来获取它?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一直在寻找并根据微软:
http://connect .microsoft.com/VisualStudio/feedback/details/371181/wcf-ierrorhandler-logging-securityexceptions
WCF将其过滤掉,所以不,你无法获取原始内容 例外。
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.