c# - WCF Callbacks not working for multiple clients -



c# - WCF Callbacks not working for multiple clients -

i've managed create wcf service callbacks. callbacks working expected, 1 client. if start client, first 1 stops receiving callbacks, sec 1 receives them twice , on. i've tried instancecontextmode in single, percall , persession mode leads same problem.

do know how prepare problem?

here's service class:

[servicebehavior(concurrencymode = concurrencymode.reentrant, instancecontextmode = instancecontextmode.single)] public class hostfunctions : ihostfunctions { #region implementation of ihostfunctions public static ihostfunctionscallback callback; public static timer timer; public void opensession() { console.writeline("> session opened @ {0}", datetime.now); callback = operationcontext.current.getcallbackchannel<ihostfunctionscallback>(); timer = new timer(1000); timer.elapsed += ontimerelapsed; timer.enabled = true; } private void ontimerelapsed(object sender, elapsedeventargs e) { if (callback != null) { callback.oncallback(); } } #endregion }

here's callback class:

[callbackbehavior(concurrencymode = concurrencymode.reentrant, usesynchronizationcontext = false)] public class callback : ihostfunctionscallback { #region implementation of icallback public void oncallback() { console.writeline("> received callback @ {0}", datetime.now); } #endregion }

i sense there proble static store reference callback in static. callback reference contain info related client callback.

that resulted first client miss when sec client registered.

more info : wcf callback multiple clients

c# wcf wcf-callbacks

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -