7

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

4

1 回答 1

10

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

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

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

于 2010-07-05T15:06:56.537 回答