Search code examples
wcfiisweb-configwcf-binding

Why sometimes endpoint address is empty


Suppose I have a WCF Service hosted in IIS, can the address in endpoint be empty? I saw an example at WCF Tutorial.

<system.serviceModel>
<services>
  <service name="MathService"
    behaviorConfiguration="MathServiceBehavior">
    <endpoint address="" contract="IMathService"
      binding="wsHttpBinding"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MathServiceBehavior">
      <serviceMetadata httpGetEnabled="True"/>
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>


Solution

  • If endpoint address is empty, it will use BaseAddress specified by the ServiceHost when you instantiate your service.