WCF – Multiple Endpoints in IIS
Background
Sometimes it is desirable to configure a WCF service to support on more than one endpoint. Implementing this on a service which is hosted outside IIS (in a console app or Windows service say) is very straight forward and logical. Surprisingly achieving this on a service which is hosted in IIS is just as easy – but it is slightly less logical.
Example
Say for example I had a simple WCF service which I want to host in IIS and support the basicHttpBinding and the wsHttpBinding. All I need to do is to add two endpoints in the config, one for each protocol, see:
[sourcecode language='xml']
[/sourcecode]
The only thing to note is that the endpoints cannot have the same address, notice that the wsHttpBinding endpoint uses the default address (the IIS route path e.g. http://localhost:3985/Service1.svc) and the basicHttpBinding use the “basic” address which will resolve to http://localhost:3985/Service1.svc/basic or something similar.
For more info see: Multiple Endpoints.