Patrice Cote
Patrice Cote

Reputation: 3716

Retrieve configuration bindings WCF

I have a service that exposes multiple endpoints. One beeing wsHttp and the other Net.Tcp. Is there any way I can know which one the clients used to make the call inside the service method ?

Thanks !

Upvotes: 0

Views: 108

Answers (2)

CriGoT
CriGoT

Reputation: 1014

You can use the OperationContext object to retrieve the channel information


if (OperationContext.Channel.LocalAddress.Uri.Scheme == Uri.UriSchemeHttp)
{
   // Called by wsHTTP
}
else if (OperationContext.Channel.LocalAddress.Uri.Scheme == Uri.UriSchemeNetTcp)
{
   // Called by NetTcp
}
...

Upvotes: 2

Flesrouy
Flesrouy

Reputation: 684

Yes. If you look at the following property you should be able to tell where things came in from.

OperationContext.Current.EndpointDispatcher.EndpointAddress 

Upvotes: 1

Related Questions