0

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

JoelFan
  • 37,465
  • 35
  • 132
  • 205

2 Answers2

0

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
  • 732,580
  • 175
  • 1,330
  • 1,459
0

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.

Community
  • 1
  • 1
chenz
  • 730
  • 7
  • 13