Design pattern for switching WCF and fault tolerance?

I am looking to determine the best practice or frequently used design pattern for WCF sharing, allowing for communication and switching to another service or local information service if WCF (or the initial service exists)

I'm not sure if this makes sense, so let me give you an example. I want this agent to connect to the wcf service and (hopefully) expose the contract methods for the caller (UI / BO, etc.), so that this object can call these methods, the agent tries to contact the primary service (probably WCF) if he could not connect to the secondary service.

Ideally, all the failover and reconnection logic will be contained in the agent.

Is there a design template that encapsulates a "switching wcf client with rollback"?
Maybe not a design template, someone recommends a decent approach?

+6
c # wcf
source share
3 answers

I would do it like this:

  • Client configuration has a single service link
  • The client has a proxy class for communication with the service
  • There is a catch attempt in the proxy class
  • In an attempt to set the address to the address of the main service and call the service
  • If this fails, you will enter the catch block, here you can set the address to the backup service and call it.
+4
source share

Juval Lowy has an excellent article on the WCF discovery protocol: http://msdn.microsoft.com/en-us/magazine/ee335779.aspx

In short, this extends the UDP broadcast mechanism to locate services that implement the specified interface. Thus, the template may consist in the fact that when the client comes to his senses, he discovers the location of the service, and for the life of this client and the service they will talk back and forth. In the event that the service provider becomes unavailable, the customer may return to open another service, and then continue.

This template allows the administrator to configure endless backup services with minimal configuration on the client.

+3
source share

I am currently working on what Shiraz describes. I have a ServiceCaller class and a call method that wraps a delegate, which is the actual service call. Before calling the delegate, I can do some other things, as well as wrap it in a try catch and centralize error handling.

http://www.lukepuplett.com/2010/07/adding-useragent-to-wcf-clients.html

In the future I plan to use NLB or MSMQ. What for? Well, switching to another resource is very closely related to load balancing, so I started with NLB.

Try these articles;

http://msdn.microsoft.com/en-us/library/ms730128.aspx

http://www.devproconnections.com/print/net-framework2/load-balancing-and-scaling-your-wcf-services.aspx

Good luck, let us know how you are doing.

Luke

+2
source share

All Articles