Soft Corner
How can we Host a WCF service on two different protocols (http,tcp etc) at Client side?
By Soft Corner in Web API on May 22 2011
  • Mohammad Elsheimy
    May, 2011 24

    Use multiple endpoints with different bindings to enable accessing the WCF svc from different locations.


    For example, we have enabled access to this service via HTTP and P2P. Here's the binding information:

    <bindings>
        <basicHttpBinding>
            <binding name="basicBinding" 
                textEncoding="utf-8" 
                openTimeout="00:03:00"
                closeTimeout="00:03:00" />
        </basicHttpBinding>     
        <netPeerTcpBinding>
            <binding name="netP2P" >
                <resolver mode="Pnrp" />
                <security mode="None" />
            </binding>
        </netPeerTcpBinding>
    </bindings>

    And those are the endpoints for the bindings:

    <endpoint address="http://localhost:8731/EmployeeWCFService.ServiceImplementation.Manager/" 
        binding="basicHttpBinding" 
        contract="EmployeeWCFService.ServiceContract.IEmployee" />
    <endpoint 
        address="net.p2p://localhost/MemberWCFService.ServiceImplementation.Member/"
        binding="netPeerTcpBinding"  
        bindingConfiguration="netp2pBinding"
        contract="MemberWCFService.ServiceContract.IMember">

    More information can be found here:

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS