Fervent Coder

Coding Towards Utopia...by Rob Reynolds
posts - 278 , comments - 431 , trackbacks - 0

My Links

News


Rob Reynolds

Subscribe to Fervent Coder RSS
Subscribe to Fervent Coder by Email

About Me

I manage several open source projects. Need...
   ...package management for Windows?
   ...automated builds?
   ...database change management (migrations)?
   ...your application to check email?
   ...a monitoring utility?

I also write for



Like what you are reading? Want to buy me a cup of coffee?
PayPal - The safer, easier way to pay online!

Article Categories

Archives

Post Categories

Image Galleries

Sites

WCF Faulted State Question

I'm calling a WCF service with a windows application. If the service errors (say you throw an exception from the service), it goes into the faulted state and I can't use the proxy anymore for calls.

In light of realizing that your proxy can only fault once, and not wanting to do one of the two things below (from Jeff's post):

  1. Subscribe to the Faulted event of the communication object. 
  2. Check the State property of the communication object before executing a service operation.
I will add option three: 
3. ReInitialize your communication object for every call.


With option three we would be using a static gateway and setting the service channel and proxy back up every time, so at least it would be centrally managed.

I definitely think option two is out the door because we would be checking state before every call and I just don't like the way that it would be implemented.

I do like option one in that it is DRY, but I have others who are not fond of using it. 

Now, with option three, we will incur additional overhead.  Does anyone know how much overhead we would deal with here or what kind of decrease we would see having to recreate the communication object every time?

Print | posted on Tuesday, October 16, 2007 2:17 PM | Filed Under [ Code WCF ]

Feedback

Gravatar

# re: WCF Faulted State Question

Hello Rob,

Well, that is interesting. But there is a case #4 as well, and may be cases #5,6 and so on. Imagine that you have a WCF service and WCF clients of two types. Sometimes a client of type 1 has to communicate with a client of type 2 via your WCF service. One has to implement some asynchronous communication, for example by means of callbacks.

But at that very moment when the client 1is sending a message to the client 2, the proxy of the type 2 has NOT to be in faulted state. Neither client of type 1 nor WCF service can reinitialise the client of type 2. So some mechanism should be implemented to solve this problem when working with callbacks. I implemented my clients sending of 'KeepAlive' message on a regular basis. On sending of the 'Keep Alive' message, the state of proxy is to be checked and the proxy has to be initialized if necessary. (I have to work with my clients in 'per session' mode, no 'singleton' is allowed.)

Does anybody know if there can be better solution, than sending 'KeepAlive' message from clients?

Best regards,
Victor
3/18/2008 6:39 AM | Victor Bober
Gravatar

# re: WCF Faulted State Question

Hmmmm...sounds like an interesting challenge. Have you talked to Juval Lowy or Michelle Leroux Bustamante about it?

I would consider them the industry experts on WCF.
3/18/2008 8:56 PM | Robz
Gravatar

# re: WCF Faulted State Question

not yet. i will check their books and post some questions to http://www.dasblonde.net/

I have just found this post in your blog and answered :)

3/19/2008 3:21 AM | Victor Bober
Gravatar

# re: WCF Faulted State Question

Yeah, its very interesting, like as many writes, i must only turn off property Reliable Sessions and its will be OK at all. So i found that it works only on server, but client lost connection line..Very interesting situations,- if i don't want reliable connection lines, i can realize it normally.)
7/30/2008 2:07 PM | Artem
Comments have been closed on this topic.

Powered by: