Protocol Bridging In WCF


Bridging => the action of putting a bridge over RIVER

In the sentence, given above, you can find that bridge has been constructed over the river with the intention that traffic flow shouldn’t be interrupted for any reason. Yes, people travelling by road transport find  it difficult to continue their journey because the river gets in their way. Bridge solves the interruption and provides a smooth flow of traffic to reach the other end. The data communication shouldn’t be interrupted across the Services as each Service owns a different set of protocol standards like one might use TCP communication, others might use HTTP communication. Here, we see protocol bridging feature from WCF to route the communication across a different set of protocol Services. Let’s discuss this in detail.

Protocol Bridging

Protocol bridging is one of the important features in WCF to route the data from the client to the Services, when both use a different set of protocols. (E.g. Client=>basicHTTBinding, WCF Service => NETTCPBinding).

In the snapshot, given above, you can find that client sends the messages in HTTP format to the router Service, but the internal Services, which are connected to the main router, do not accept the messages in an HTTP format. It rather accepts it only in a TCP format. Thus, the router switches to a different binding, according to the internal Service and sends the message. The client will get the response messages in HTTP format. It’s a complete responsibility of Router to read the data in a source protocol and switch into the destination protocol, based on the need. It can also be useful, when you don’t want some complex Services. The actual URL shouldn’t be exposed to the client. In this case, you can provide only the main router Service URL to the client, the main router Service then redirects the messages to the actual Service, based on the message filtering.

Routing Configuration

As mentioned in the previous snapshot, we shall configure two Services, which are Router or Front end Service and internal Service. Internal Service will accept the messages in a TCP format, Router Service will accept the messages in HTTP format.

Step 1

As a first step, we shall configure the internal Service named FoodInventory Service, which accepts the messages in a TCP format. As mentioned in the snapshot, given below, you can configure the Service Library.


You can find the Service Library created with the address “net.tcp://localhost:8523/FoodInventoryLib/Service” and the binding is NETTCPBinding . Once the Service Library is created, it can be hosted. In this case, we will do the Self-Hosting. If you need any assistance for Self-Hosting, please refer to my article “Hosting in WCF”.

Step 2

Once the internal Service is configured, we need to configure the Router Service or Front-end Service. As mentioned in the snapshot, given below, you can configure the Routing Service, which routes the messages, based on the message content, Filters. If you need any assistance on configuring Routing Service, refer the article “Configuring WCF Routing”.


We have to remember the four important configurations in creating Router Service configuration. I will suggest that you  remember the simple sentence to recollect the routing Server configuration, which is “Address the Filter Table and Filter End”. Yes, Address = > you shouldn’t forget to update the Server address. In our case, it is http://localhost:8543/MainRouteServer/Router, a client will use this address to send all the messages. Next is Filter Table. Once you define the address, don’t forget to declare the FilterTableName in Service Behaviour Tag, and then create the same Filtertable in Routing Tag. In our case, it is “RoutingInformationTable”. Next is Filter. Create and add the Filter in the filtertable. In our case, it is “MatchAllFilter”, Final one is End. You need to create the endpoint and associate the same in the filtertable. The configuration, given above says that if the message filter is applied successfully,  you can redirect the message to the endpoint listed. In our case, if any incoming message contains the endpoint address as http://localhost:8543/MainRouteServer/Router, the message will be redirected to the service net.tcp://localhost:8523/FoodInventoryLib/Service. Wherever the Service needs to be routed, just simply update the name of the binding with the Service URL. In our case, you can find that endpoint has been created under the client tag with the address and binding details. WCF internally switches (bridges) the protocol into TCP format and sends the messages to the internal Service. Once the internal Service is responded to the Main router Service, it again switches (bridges) the protocol into HTTP format before sending to the client.

Hope you have enjoyed  learning. Please update the comments/likes as a token of appreciation.


Protocol bridging is an important feature in WCF routing. It will be useful, when you need the data to travel among the various sets of protocol Services.

Similar Articles