Search code examples
wcfendpointendpointswcf-endpoint

Advantages of multiple endpoints in WCF service


I am new to WCF. Please tell me what is advantage of creating multiple endpoints to a wcf web service?

Also can you please help me with an example that how to host such service in IIS and how a wcf client will connect to exact endpoint provided.

Thanks.


Solution

  • The advantage of providing different endpoints is that each endpoint could use different binding. This way based on the client capabilities he could choose the appropriate binding. For example you could expose an interoperable endpoint for Java, PHP, ... clients and a proprietary binary endpoint which could be faster but only for .NET clients.

    Each endpoint has address, binding and contract. So the client could choose which service endpoint he wants to consume.

    To host a WCF service in IIS you have 2 possibilities: either in an ASP.NET application where only HTTP bindings are available (basicHttpBinding, wsHttpBinding, webHttpBinding, ...) or in WAS (IIS 7.0 only) where you can use binary bindings. From a client perspective you add a Service Reference to the client project pointing to a given service url and consume the service. And here's another article you which discusses this.