BarneyHDog
BarneyHDog

Reputation: 510

Multiple WCF Services (self hosted)

I have a set of WCF Services which are hosted from within a Windows Service.

I need to run multiple instances - which is fine, I can do that using unique endpoints, however for a given instance I need to known which instance it is.

For example I might have end points:

net.tcp://localhost:9000/Customer1/MyServerFunctions

net.tcp://localhost:9001/Customer2/MyServerFunctions

When a the WCF Service is called I need to know whether it is for Customer1 or Customer2

Suggestions?

Upvotes: 0

Views: 264

Answers (1)

Chris Dickson
Chris Dickson

Reputation: 12135

Your service implementation can call

OperationContext.Current.Channel.LocalAddress

to determine which customer endpoint the request came from.

Upvotes: 3

Related Questions