locked
exposing limited methods via diffrent endpoints ? RRS feed

  • Question

  • User547991737 posted

    I have a WCF service, Which has 5 methods
    I want to expose 3 methods using an endpoint and remaining 2 method using different endpoint. 
    is it possible without moving them to a different class?

    Monday, April 10, 2017 6:23 AM

All replies

  • User-1509636757 posted

    The easiest solution would be to separate them into different services for each client. Alternatively, you will require to expose all the methods (OperationContract) then do an authorization check on method level to check whether the client who is accessing has sufficient permission to actually call it or not.

    Monday, April 10, 2017 6:32 AM
  • User-2057865890 posted

    Hi arry.net,

    Each endpoint consists of the following:

    Address: The address uniquely identifies the endpoint and tells potential consumers of the service where it is located.

    Binding: The binding specifies how to communicate with the endpoint.

    Contracts: The contract outlines what functionality the endpoint exposes to the client.

    Address + Binding + Contracts = Endpoint

    So if you change either of Address, Contract or Binding then a new EndPoint will be created. You may have multiple EndPoints of the same service.

    Creating two EndPoints for the same service

    <service name="MessagePatternDemo.Service1">  
      <endpoint name="ep1"  
                address="/ep1"  
                binding="basicHttpBinding"  
                contract="MessagePatternDemo.IService1"/>  
      <endpoint name="ep2"  
                address="/ep2"  
                binding="wsHttpBinding"  
                contract="MessagePatternDemo.IService1" />  
      <endpoint name="mex"  
                contract="IMetadataExchange"  
                address="mex"  
                binding="mexHttpBinding" />  
    </service>   

    Dealing With Multiple EndPoints of a WCF Service

    Best Regards,

    Chris

    Monday, April 10, 2017 8:06 AM