Friday, August 28, 2009

WCF error Catastrophic Failure

My wcf service was constantly timing out. Note that I had a session based service i.e:

  • on the contract:
[ServiceContract(SessionMode=SessionMode.Required)]

  • on the implementation:
[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)]

Now what was happening was that I put a break point on a function and called it MANY times. It wasn't being triggered after the first couple of times. Figured it out (after mike's tutorial on sessions and instancing). Some got timed out. And because of that the queue got messed up and resulted in the catastrophic failure. Since I dont do anything thread unsafe in general I changed the behavior on the implementation to :

[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession,ConcurrencyMode = ConcurrencyMode.Multiple)]


Got the hint from here (read the sessions and streaming section).


Enjoy!

No comments:

Post a Comment