What is Endpoint?How to add multiple Endpoints in Same Service – WCF ?

What is Endpoint?How to add multiple Endpoints in Same Service – WCF ?the Endpoint is the fusion of the address,contract and binding.Every service is associated with an address that defines where the service is,a binding that defines how to communicate with the service,and a contract that define what the service does. WCF formalizes this relationship in the form of an endpoint.

Every Endpoint will have all these 3 elements, and the host expose the Endpoint. Every Services exposes atleast one Endpoint, And each Endpoint will have one contract. All Endpoints on a service have unique address, and a single service can have multiple Endpoints. These Endpoints can use same or different binding and can expose the same or different contracts.There is no interrelationship between any Endpoints.

<System.ServiceModel>
<services>
<service name = "MyNamespace.MyService">
<endpoint
address = "http://localhost/MyService"
binding = "wsHttpBinding"
contract = "MyNamespace.IMyContract"
/>
</service>
</services>
</System.ServiceModel>

How to add multiple Endpoints in Same Service – WCF ?


<service name = "MyNamespace.MyService">
<endpoint
address = "http://localhost/MyService"
binding = "wsHttpBinding"
contract = "IMyContract"
/>
</service>
<service name = "MyNamespace.MyService">
<endpoint
address = "net.tcp://localhost:8001/MyService"
binding = "nettcpBinding"
contract = "IMyContract"
/>
</service>
<service name = "MyNamespace.MyService">
<endpoint
address = "HTTP://localhost/MyService"
binding = "wsHttpBinding"
contract = "IMyOtherContract"
/>
</service>

Posted in

Leave a Reply

Your email address will not be published. Required fields are marked *