Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 WCF 安全性中,给定当前 OperationContext,确定请求是 SOAP 请求还是 REST 请求的最佳方法是什么?
您可以查看 ChannelDispatcher 上的绑定名称:
string bindingName = OperationContext.Current .EndpointDispatcher.ChannelDispatcher.BindingName;
对于 REST,它将是webHttpBinding- 其他任何东西都是 SOAP。
webHttpBinding