gpt4 book ai didi

wcf - 为什么 WCF SoapFault 响应在某些情况下被加密?

转载 作者:行者123 更新时间:2023-12-04 08:55:47 25 4
gpt4 key购买 nike

我正在创建一个 WCF web 服务,它的请求/响应应该只签名。
为此,我在 ServiceContract 属性上设置了

ProtectionLevel = ProtectionLevel.Sign

这工作正常。

由于要求,一些 SoapFaults 应该从服务中抛出;两种类型的 SoapFaults:
  • 申请相关
  • 与 WS-Addressing 相关(例如 MessageID 丢失)

  • 为此,我使用处理 SoafFaults 的正常方法:创建一个 IErrorHandler,其中使用 MessageFault.CreateFault 创建一个 Message 实例。

    几乎所有返回的 SoapFaults 都没有加密(这对我来说没问题),
    我的问题是为什么带有 action="http://www.w3.org/2005/08/addressing/fault"或 " http://www.w3.org/2005/08/addressing/soap/fault "的那些被加密了?

    最佳答案

    退房 http://msdn.microsoft.com/en-us/library/aa347791.aspxhttp://msdn.microsoft.com/en-us/library/system.servicemodel.faultcontractattribute.aspx .
    它指出

    If you select a binding that enables security and you do not set the ProtectionLevel property anywhere on the contract, all application data will be encrypted and signed.



    我猜默认情况下内置类型使用这种行为。您可以通过查看实际抛出的异常来验证这一点。

    关于wcf - 为什么 WCF SoapFault 响应在某些情况下被加密?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13799473/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com