Posted on

Yesterday we run into problem with wcf configuration in IIS to make our Silverlight application working. When you using standard 443 or even custom ssl port in endpoint configuration everything is ok:


        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
            <service behaviorConfiguration="WCFServiceBehavior"
                <endpoint address=""
                        <dns value="localhost"/>
                <behavior name="FaultBehavior">
                <behavior name="WCFServiceBehavior">
                    <serviceMetadata />
                    <serviceDebug includeExceptionDetailInFaults="false"/>
                <binding name="http">
                  <binaryMessageEncoding />
                  <httpTransport />
                <binding name="https">
                  <binaryMessageEncoding />
                  <httpsTransport />


As you can see you can leave endpoint address empty and use http or https custom binding in binding configuration based on your web site protocol.

But this approach is not working when you have load balancer configured to redistribute traffic across  few physical machines. Your load balancer will redirect traffic from  443 port to custom defined (for example 543 port) of your physical  boxes.  This is creating problem of contact mistmatching since Silver light has precompiled setting of endpoint without any knowledge how mapping is done. In order to make it working you need full domain name specified in your end point address and listenUri attribute which contains reference to localhost with custom ssl port number.





Attribute description in MSDN