Saturday, February 6, 2010

Multiple endpoints for a WCF service hosted in IIS

Last week I had to deploy a service with multiple endpoints in IIS.

In this case my WCF service has 2 addresses, a base address and an endpoint address.

The base address is used for meta data. It matches to the SVC file we’ve created to host our service in IIS. So if a consumer uses our service. It will extract the WSDL metadata from this address. In your browser you will only be able to access the base address.

For example, http://localhost/IBuySpy/OrderService.svc

Inside your service,you can have an address for each endpoint. When you are actually calling the service, you will not be using the base address but one of endpoint address.  Most of the time I configure my service so that for one address the base address and endpoint address are the same.

So when you are calling the service from a client app,you can use both addresses,



The corresponding service configuration will look like this:

   1:  <system.serviceModel>
   2:     <services>
   3:        <service type="IBuySpy.OrderService">
   4:           <endpoint address="" binding="basicHttpBinding" contract="IBuySpy.IOrderService"/>
   5:           <endpoint address="Endpoint2" binding="wsHttpBinding" contract="IBuySpy.IOrderService"/>
   6:        </service>
   7:     </services>
   8:  </system.serviceModel>

1 comment:

Sagar R said...

I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Windows foundation communication, kindly contact us
MaxMunus Offer World Class Virtual Instructor led training on Windows foundation communication. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Demo Contact us:
Name : Arunkumar U
Email :
Skype id: training_maxmunus
Contact No.-+91-9738507310
Company Website –