1
Reply

How can we Host a WCF service on two different protocols (http,tcp etc) at Client side?

Soft Corner

Soft Corner

13y
6.4k
0
Reply

    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: