WCF Callback Faulted - what happens to the session?

Posted by RemotecUk on Stack Overflow See other posts from Stack Overflow or by RemotecUk
Published on 2010-03-14T19:03:21Z Indexed on 2010/03/14 19:05 UTC
Read the original article Hit count: 428

Filed under:
|
|
|

Just trying to get my head around what can happen when things go wrong with WCF. I have an implementation of my service contract declared with an InstanceContextMode of PerSession...

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

The calls happen as follows:

  1. My client calls the server and calls GetServerUTC() to return the current UTC time of the server. This is a one way call and the server will call the client back when its ready (trivial in this instance to simply return the current time!)

  2. The server calls back to the client and for test purposes in the callback implementation on the client I throw an exception.

  3. This goes unhandled in the client (for test purposes) and the client crashes and closes down.

  4. On the server I handle the faulted event handler on the ICommunicationObject...

    obj.Faulted += new EventHandler(EventService_Faulted);

Questions...

  • Will this kill off the session for the current connection on the server.

  • I presume I am free to do what I want in this method e.g. logging or something, but should I do anything specific here to terminate the session or will WCF handle this?

From a best practise view point what should I do when the callback is faulted? Does it mean "something has happened in your client" and thats the end of that or is there something I a missing here?

Additionally, are there any other faulted handlers I should be handling.

Ive done a lot of reading on WCF and it seems sort of vague on what to do when something goes wrong. At present I am implementing a State Machine on my client which will manage the connection and determine if a user action can happen dependant on if a connection exists to the server - or is this overkill.

Any tips would be really appreciated ;)

© Stack Overflow or respective owner

Related posts about wcf

Related posts about callback