gpt4 book ai didi

WCF:使用 OperationContext 区分 REST 和 SOAP 请求

转载 作者:行者123 更新时间:2023-12-04 11:16:30 27 4
gpt4 key购买 nike

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

最佳答案

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

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

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

关于WCF:使用 OperationContext 区分 REST 和 SOAP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3179863/

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