Vishwamohan

Welcome to Vishwa's blog - Technology, Spirituality and More...

WCF Service Hosted in Web Farm or Multi-Homed Scenario

If a WCF Service is deployed in a load balanced environment and hosted on multiple Web Servers under IIS, which is accessed on a public domain, WCF WSDL document refers to a the responding machine name which is generally inaccessible on a public domain. So what you should be doing to make it right?

As per Microsoft, this design was initially designed in WCF but later when Microsoft went into Azure or Cloud Computing, this situation became an issue and realized the need to fix this problem. So in order to fix this problem, you need to perform two simple steps

1. Download the following Fix from Microsoft and Install on respective machines

                         http://code.msdn.microsoft.com/KB971842/Release/ProjectReleases.aspx?ReleaseId=3228

2. Add the following sections in behavior section of configuration

   1: <serviceBehaviors>
   2:    <behavior name="<name>">
   3:      <useRequestHeadersForMetadataAddress>
   4:        <defaultPorts>
   5:           <add scheme="http" port="80" />
   6:           <add scheme="https" port="443" />
   7:         </defaultPorts>
   8:       </useRequestHeadersForMetadataAddress>
   9:    </behavior>
  10: </serviceBehaviors>
  11:  
  12:  

For more information, you can checkout the following articles

a. http://support.microsoft.com/kb/980588

b. http://support.microsoft.com/kb/971842

Loading