【问题标题】:WCF: Distinguish between REST and SOAP requests using the OperationContextWCF:使用 OperationContext 区分 REST 和 SOAP 请求
【发布时间】:2016-09-07 19:58:33
【问题描述】:

在 WCF 安全性中,给定当前 OperationContext,确定请求是 SOAP 请求还是 REST 请求的最佳方法是什么?

【问题讨论】:

    标签: wcf rest soap operationcontext


    【解决方案1】:

    您可以查看 ChannelDispatcher 上的绑定名称:

    string bindingName = OperationContext.Current
                            .EndpointDispatcher.ChannelDispatcher.BindingName;
    

    对于 REST,它将是 webHttpBinding - 其他任何东西都是 SOAP。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-16
      • 2011-01-18
      • 1970-01-01
      • 2012-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-29
      相关资源
      最近更新 更多