none
Discuss Advantages of multiple endpoints in WCF service RRS feed

  • Question

  • One guy explained this way but not very clear to how to implement it.

    From experience:

    Using different binding, for example one BasicHttpBinding for Java clients while using WsHttpBinding for .NET clients. Also HTTPS for some and HTTP for others...

    Dividing and exposing different contracts/interfaces. For example you have one interface that exposes many operations and you have a cut down interface which does basic things and you publish the second to outside so internal clients use the endpoint for extended interface but external clients use the other one.

    For example

    interface IFoo
    {
       void DoBasic();  
    }
    
    interface IFooInternal : IFoo
    {
       void DoMore();  
    }
    
    Now you have One class implementing both:
    
    public class Foo : IFooInternal 
    {
        ....
    }

    And now you expose only one to outside while implementation is in the same class.

    the things which i do not understand how to design my service contract in such a way that few operation i will expose to other client and extended feature i will expose to internal client. so if possible just make me understand giving me a small program & code that how it can be possible through multiple endpoints in WCF service. thanks

    Friday, February 7, 2014 10:40 AM

Answers

  • Hi,

    If we do the above, then there will be two service contracts(IFoo and IFooInternal ), different contracts can been exposed on different endpoints. Address of the endpoints can be given as relative to baseaddress. And each endpoint contains a unique name also. So Address is unique for each endpoint. Then we can call different endpoint address based on our requirement.

    The following article show the code and how to implement it, please try to check it:
    #Multiple Service Contracts in WCF Service:
    http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/multiple-service-contracts-in-wcf-service/ .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Mou_kolkata Wednesday, February 12, 2014 6:53 AM
    Monday, February 10, 2014 3:09 AM
    Moderator