Explain The Purpose Of Base Address in WCF Service? How To Specify Base Address in WCF? | WCF Interview Question

, ,
When multiple endpoints are associated with WCF service, base address (one primary address) is assigned to the service, and relative addresses are assigned to each endpoint. Base address is specified in <host> element for each service.

E.g.

<configuration>

    <system.servicemodel>

      <Services>

<service name=”MyService>

  <host>

  <baseAddresses>

 <add baseAddress =”http://localhost:6070/MyService”>

</baseAddresses>

</host>

</service>

<services>

</system.servicemodel>

</configuration>