none
multiple service contract with single binding RRS feed

  • Question

  • Hi

    I am new to WCF and would like to use two or more service contract using same end point binding such as netTCPBinding.

    I have done some research but no luck any advice

    Monday, March 30, 2015 12:29 PM

Answers

  • >>I am new to WCF and would like to use two or more service contract using same end point binding such as netTCPBinding.

    It is not possible for two different contracts to use the same endpoint since an endpoint consists of an address that indicates where the endpoint can be found, a binding that specifies how a client can communicate with the endpoint and a contract that identifies the operations available.

    So the contract is an essential part of the endpoint.

    The two contracts can use the same binding (e.g. wsHttpBinding) though:

    <services>
       <service name="WCFServices.TestServices.MultipleServices">
          <endpoint 
              address="Service1" 
              binding="wsHttpBinding"
              contract="WCFServices.TestServices.ITestSvc1">
              <identity>
                <dns value="" />
              </identity>
          </endpoint>
          <endpoint 
              address="Service2" 
              binding="wsHttpBinding"
              contract="WCFServices.TestServices.ITestSvc2">
              <identity>
                <dns value="localhost" />
              </identity>
          </endpoint>
          <endpoint 
               address="mex" 
               binding="mexHttpBinding"  
               contract="IMetadataExchange" />
       </service>     
    </services>

     

    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question. Please only ask one question per thread.

    Monday, March 30, 2015 3:44 PM
  • Hi,

    For this scenario, Endpoints identify a WCF Service. An EndPoint is a combination of Address, Contract and Binding. Mathematically an EndPoint can be defined as below:
    A+B+C=E

    • If the same service is hosted      on multiple addresses with the same Binding and the same Contract
    • If the same service with a      different Contract on the same Address and for the same Binding
    • If the same service with a      different Bindings on the same Address and for the same Contract.

    We can say that as a service designer you may consider to create multiple EndPoints in the following scenarios.

    1. Service wants to expose more      than one type of binding.
    2. Service wants to expose more      than one contract on the same binding.
    3. Service wants to expose same      binding and contract on different addresses.

    For more information, you could refer to:

    http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/dealing-multiple-endpoints-of-a-wcf-service499/

    Regards

    Tuesday, March 31, 2015 1:52 AM
    Moderator

All replies

  • >>I am new to WCF and would like to use two or more service contract using same end point binding such as netTCPBinding.

    It is not possible for two different contracts to use the same endpoint since an endpoint consists of an address that indicates where the endpoint can be found, a binding that specifies how a client can communicate with the endpoint and a contract that identifies the operations available.

    So the contract is an essential part of the endpoint.

    The two contracts can use the same binding (e.g. wsHttpBinding) though:

    <services>
       <service name="WCFServices.TestServices.MultipleServices">
          <endpoint 
              address="Service1" 
              binding="wsHttpBinding"
              contract="WCFServices.TestServices.ITestSvc1">
              <identity>
                <dns value="" />
              </identity>
          </endpoint>
          <endpoint 
              address="Service2" 
              binding="wsHttpBinding"
              contract="WCFServices.TestServices.ITestSvc2">
              <identity>
                <dns value="localhost" />
              </identity>
          </endpoint>
          <endpoint 
               address="mex" 
               binding="mexHttpBinding"  
               contract="IMetadataExchange" />
       </service>     
    </services>

     

    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question. Please only ask one question per thread.

    Monday, March 30, 2015 3:44 PM
  • Hi,

    For this scenario, Endpoints identify a WCF Service. An EndPoint is a combination of Address, Contract and Binding. Mathematically an EndPoint can be defined as below:
    A+B+C=E

    • If the same service is hosted      on multiple addresses with the same Binding and the same Contract
    • If the same service with a      different Contract on the same Address and for the same Binding
    • If the same service with a      different Bindings on the same Address and for the same Contract.

    We can say that as a service designer you may consider to create multiple EndPoints in the following scenarios.

    1. Service wants to expose more      than one type of binding.
    2. Service wants to expose more      than one contract on the same binding.
    3. Service wants to expose same      binding and contract on different addresses.

    For more information, you could refer to:

    http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/dealing-multiple-endpoints-of-a-wcf-service499/

    Regards

    Tuesday, March 31, 2015 1:52 AM
    Moderator