[Note: all the information was gathered based on a close-to-Beta 1 build of .NET Framework 4.0 and Visual Studio 2010. Details may vary and change]
Let's look at some more features of the new RoutingService in WCF4.
We are going to expose our RoutingService via an basicHttpBinding-based request-reply endpoint:
<service behaviorConfiguration="routingData"
name="System.ServiceModel.Routing.RoutingService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:7777/Services/Universal"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
name="requestReplyEndpoint"
contract="System.ServiceModel.Routing.IRequestReplyRouter" />
</service>
Then 'internally' we have two business services, HelloService1 and HelloService2 :)
One of them is exposed via a basicHttpBinding-based endpoint, the other one uses netTcpBinding.
We can now configure our router in such a way that it still accepts incoming messages via basicHttpBinding (actually we just did that and do not need to change anything) but can route messages to the netTcpBinding-based service.
<client>
<endpoint name="HelloService1"
address="net.tcp://localhost:7778/Services/Hello"
binding="netTcpBinding"
contract="*" />
<endpoint name="HelloService2"
address="http://localhost:7777/Services/Hello"
binding="basicHttpBinding"
contract="*" />
</client>
OK, great.
Our routing table looks like this, which means we will always (try to) route to the netTcpBinding-based service.
<routingTables>
<table name="mainRoutingTable">
<entries>
<add filterName="xPath1" endpointName="HelloService1" />
</entries>
</table>
</routingTables>
But what happens if *** happens?
We can specify alternate endpoints which will be called when a CommunicationException or TimeoutException occurs in the RoutingService while calling the original target endpoint.
<routingTables>
<table name="mainRoutingTable">
<entries>
<add filterName="xPath1" endpointName="HelloService1" alternateEndpoints="endpointsList" />
</entries>
</table>
</routingTables>
<alternateEndpoints>
<list name="endpointsList">
<endpoints>
<add endpointName="HelloService2" />
<!--<add endpointName="HelloService3" />-->
</endpoints>
</list>
</alternateEndpoints>
We can have as many alternate endpoints as we like, in this sample it is just one active one, namely our HelloService2 which is exposed via a basicHttpBinding endpoint.
That's it: protocol bridging & fault tolerance with the Routing Service in WCF4.
Can you add the app.config of the client !
Posted by: Michel Girard | 04/02/2010 at 10:07 PM
Well don't know whats going on but its not a Good way to do this. in my opinion we have to look again about this issue
Posted by: company logo design | 07/26/2010 at 10:28 AM