Ask a questionAsk a question
 

AnswerWCF with basicHttpBinding over SSL

  • Wednesday, October 28, 2009 10:13 PMTrevor Ward Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

      I have several WCF services running properly over Http and as I would like to host them over https instead.  However, I can't make it work!
    When I log into my website and my app loads (it's in Silverlight), nothing happens.


    I have my web.config configured as follows:

    <system.serviceModel>
      <services>
       <service name="namepsace.Service1" behaviorConfiguration="namespace.DefaultBehavior">
        <!-- Service Endpoints -->
        <endpoint address="https://SERVER/Application/WcfServices/Service1"
                      binding="basicHttpBinding"
                      bindingConfiguration="sslConfig"
                      name="Service1.Https"
                      contract="namespace.IService1" /> 
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="https://SERVER/Application/WcfServices/Service1" />
              </baseAddresses>
            </host>
       </service>
       ... 3 more services configured as above ..
    <behaviors>
       <serviceBehaviors>
        <behavior name="namespace.DefaultBehavior">
         <serviceMetadata httpsGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
       </serviceBehaviors>
      </behaviors>
       
        <bindings>
          <basicHttpBinding>
            <binding name="sslConfig">
              <security mode="Transport">
                <transport clientCredentialType="None" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>

    Then in my ServiceReference.ClientConfig file inside my xap (my client is Silverlight)

    <configuration>
        <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="Service1.Https" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
                        <security mode="Transport" />
                    </binding>    
                     ... 3 more bindings defined for my other 3 services.  configured same as this one ...
                  </basicHttpBinding>
             </bindings>
            <client>
                <endpoint address="https://SERVER/Application/WcfServices/Service1.svc"
                    binding="basicHttpBinding" bindingConfiguration="Service1.Https"
                    contract="namespace.IService1" name="BasicHttpBinding_IService1" />
                 ... 3 more endpoints for the other services
            </client>
        </system.serviceModel>
    </configuration>


    Am I missing something here?  Any help would be much appreciated.

    Trevor

Answers

  • Wednesday, November 04, 2009 6:54 PMTrevor Ward Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi guys,

      Thanks for your responses.  After reading through the links you posted and several others, I finally got it working by adding the following to the <seviceMetaData> tag in each service behavior:

     HttpsGetURL="https://SERVER/Application/WcfServices/Service1" 

     
    Everything is working beautifully for me now. 

    Thanks again,
       Trevor
    • Marked As Answer byTrevor Ward Wednesday, November 04, 2009 6:54 PM
    •  

All Replies