Sunday, February 13, 2011

2 Endpoints for netTcpBinding with different contracts

Need to use same netTcpBinding binding but need additional endpoint for different contract? here's how:

1. It's very good to read this article
2. If you have current netTcpBinding it should look like this:



3. what you have here is a TCP type of WCF with base address. Thats a deafult implementation of netTcpBinding.
4. I suggest you to use the VS20010 tool "Edit WCF Configuration" to edit the App.config file instead of manually edition it.
5. Add additional end point same values as the 1'st netTcpBinding binding (leave the MexTcpBidingEndpoint alone)
6. Change the folowing :

  • give each endpoint a name (the default implementation keeps them empty , it's good to give them some name to know on which one you are working on
  • for each give a unique name in the address section , thats the magic here , giving the base address (see host baseaddress section) allownig wach binding to "sit" in a unique position within the service , leaving this section empty will cause assertion such as "When multiple endpoints on a service share the same ListenUri, those endpoints must all have the same Identity in their EndpointAddress."
  • For each binding state the contract.
7. the app.config script should look like this:


8. Thats it , Cool , no?

0 תגובות:

Post a Comment

 
Home | About | Link | Link
Simple Proff Blogger Template Created By Herro | Inspiring By Busy Bee Woo Themes