Question

i have a wcf service in c# (like the calculatorservice from msdn examples), and i was wondering is it possilble to limit it to serve only 1 client per IP?

i want the possibility of a few IPs to be connected at once (at least 5-6 active sessions), and that works for now, but i don't want more than 1 connection per unique IP (or unique computer)

Was it helpful?

Solution 2

i made some progress. when the client invokes the service for the first time, in the constructor i save his ip address and his current operation context.

then, if someone from the same ip connects, i abort the previous channel that that ip address used (newest connection has the priority):

operationContext.Channel.Abort();

i tested it, and it appears to free up the session so others can use it, but i am not sure -- is this the best solution?

OTHER TIPS

If you need 5 opened sessions at one time and you are saying that maxConcurrentInstances causes only 1 usuable client, have you set the InstanceContextMode to = PerSession? You most likely have it set to Single, in that case maxConcurrentCalls has no effect. Change it to PerSession and the throttling config ForeverDebugging has shown will work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top