tags:

views:

76

answers:

2

Inside a WCF service, can I find out which URI was used to call me?

A: 

Well, you can e.g. look at:

string localAddress = OperationContext.Current.Channel.LocalAddress

Is that what you're looking for?

Basically, on the server side, you'll probably only be able to determine which of the server's endpoints was hit - you most likely won't be able to really find out what the caller on the client used as a URL (just a hunch).

Marc

marc_s
A: 

There is other thread that might answer your question.

The OperationContext.Current.Channel.LocalAddress will not work in a service that is hosted in IIS which have multi websites. Using OperationContext.Current.IncomingMessageHeaders.To is more logical.

chenz