在ExceptionShielding下发生System.ServiceModel.Security.MessageSecurityException

5 wcf enterprise-library exception-handling

我们正在使用企业库4.1异常处理应用程序块的ExceptionShielding功能以及与我们的WCF服务的自定义RoleProvider.

当RoleProvider确定用户不在角色中并从IsInRole方法返回false时,发生以下异常:

    System.ServiceModel.Security.MessageSecurityException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    No signature message parts were specified for messages with the '{XXX}' action.

然后WCF中止RequestContext服务操作,客户端超时.

我试图在此链接中提到的解决方案没有成功:

http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=25236

我们还System.Exception从EHAB政策中删除了异常类型,实际上EHAB对此策略没有任何作用,这没有任何效果.

防止此异常的唯一方法是ExceptionShielding在服务实现上注释掉该属性.

对此问题的任何修复都将非常感激.

Ali*_*tad 2

我花了几个小时试图找出原因。我已经在这里发布了我的答案。

基本上,您需要定义故障操作并将其设置为相同的命名空间。