We often encounter this situation: the client accessing the Service may come from different systems and applications. You can use different bindings to define multiple endpoints to allow different client platforms to access services using their supported transport protocols.
Multiple bindings are declared:
<? Xml version = "1.0"?> <Configuration> <system. serviceModel> <services> <service name = "MyService"> <endpoint address = "http: // localhost: 8080/MyService "binding =" wsHttpBinding "contract =" IMyService "/> <endpoint address =" http: // localhost: 8080/MyService/basic "binding =" basicHttpBinding "contract =" IMyService "/> </service> </services> <bindings> <wsHttpBinding> </bindings> </system. serviceModel> </configuration>
The program adds two endpoints: wsHttpBinding and basicHttpBinding.
Note: first, the binding is different. Second, the address is different. In addition, if you want to use another different contract, you can use the same address and the same binding as the endpoint. If the address is not unique and the contract is the same, an exception occurs.